summaryrefslogtreecommitdiff
path: root/test/junit/scala/collection/IteratorTest.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2016-09-05 21:59:08 -0700
committerSom Snytt <som.snytt@gmail.com>2016-09-05 21:59:08 -0700
commitdc6b91822f695250938ee06ad21818b1ca8a778d (patch)
treecb1b234fb886fb1849d0d0093e404a694c8aa4fc /test/junit/scala/collection/IteratorTest.scala
parent81a67eeacc7d2622ee364a21203b227142e2043e (diff)
downloadscala-dc6b91822f695250938ee06ad21818b1ca8a778d.tar.gz
scala-dc6b91822f695250938ee06ad21818b1ca8a778d.tar.bz2
scala-dc6b91822f695250938ee06ad21818b1ca8a778d.zip
SI-9913 Lead span iterator finishes at state -1
Even if no elements fail the predicate (so that the trailing iterator is empty).
Diffstat (limited to 'test/junit/scala/collection/IteratorTest.scala')
-rw-r--r--test/junit/scala/collection/IteratorTest.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/junit/scala/collection/IteratorTest.scala b/test/junit/scala/collection/IteratorTest.scala
index d980cadeb3..f18a4de4e9 100644
--- a/test/junit/scala/collection/IteratorTest.scala
+++ b/test/junit/scala/collection/IteratorTest.scala
@@ -164,6 +164,12 @@ class IteratorTest {
assertEquals(1, y.next)
assertFalse(x.hasNext) // was true, after advancing underlying iterator
}
+ // SI-9913
+ @Test def `span leading iterator finishes at state -1`(): Unit = {
+ val (yes, no) = Iterator(1, 2, 3).span(_ => true)
+ assertFalse(no.hasNext)
+ assertTrue(yes.hasNext)
+ }
// SI-9623
@Test def noExcessiveHasNextInJoinIterator: Unit = {
var counter = 0