You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by he...@apache.org on 2025/01/24 22:42:30 UTC
(pekko) branch main updated: chore: Add the missing EmptySource case to TraversalBuilder (#1743)
This is an automated email from the ASF dual-hosted git repository.
hepin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/main by this push:
new ba639f68a2 chore: Add the missing EmptySource case to TraversalBuilder (#1743)
ba639f68a2 is described below
commit ba639f68a2eebb521e01879f584d2f682a7934eb
Author: He-Pin(kerr) <he...@gmail.com>
AuthorDate: Sat Jan 25 06:42:25 2025 +0800
chore: Add the missing EmptySource case to TraversalBuilder (#1743)
---
.../pekko/stream/impl/TraversalBuilderSpec.scala | 18 +++++++++++++++++-
.../apache/pekko/stream/impl/TraversalBuilder.scala | 1 +
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/TraversalBuilderSpec.scala b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/TraversalBuilderSpec.scala
index 484ac0ed47..063b9ec335 100644
--- a/stream-tests/src/test/scala/org/apache/pekko/stream/impl/TraversalBuilderSpec.scala
+++ b/stream-tests/src/test/scala/org/apache/pekko/stream/impl/TraversalBuilderSpec.scala
@@ -17,7 +17,7 @@ import org.apache.pekko
import pekko.NotUsed
import pekko.stream._
import pekko.stream.impl.TraversalTestUtils._
-import pekko.stream.scaladsl.Keep
+import pekko.stream.scaladsl.{ Keep, Source }
import pekko.testkit.PekkoSpec
class TraversalBuilderSpec extends PekkoSpec {
@@ -447,4 +447,20 @@ class TraversalBuilderSpec extends PekkoSpec {
}
}
+ "find Source.empty via TraversalBuilder with isEmptySource" in {
+ val emptySource = EmptySource
+ TraversalBuilder.isEmptySource(emptySource) should be(true)
+ }
+
+ "find javadsl Source.empty via TraversalBuilder with isEmptySource" in {
+ import pekko.stream.javadsl.Source
+ val emptySource = Source.empty()
+ TraversalBuilder.isEmptySource(emptySource) should be(true)
+ }
+
+ "find scaldsl Source.empty via TraversalBuilder with isEmptySource" in {
+ val emptySource = Source.empty
+ TraversalBuilder.isEmptySource(emptySource) should be(true)
+ }
+
}
diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/TraversalBuilder.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/TraversalBuilder.scala
index 7ff61a2b3a..22c006601b 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/impl/TraversalBuilder.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/impl/TraversalBuilder.scala
@@ -386,6 +386,7 @@ import pekko.util.unused
def isEmptySource(graph: Graph[SourceShape[_], _]): Boolean = graph match {
case source: scaladsl.Source[_, _] if source eq scaladsl.Source.empty => true
case source: javadsl.Source[_, _] if source eq javadsl.Source.empty() => true
+ case EmptySource => true
case _ => false
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org