From dc6b91822f695250938ee06ad21818b1ca8a778d Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Mon, 5 Sep 2016 21:59:08 -0700 Subject: SI-9913 Lead span iterator finishes at state -1 Even if no elements fail the predicate (so that the trailing iterator is empty). --- test/junit/scala/collection/IteratorTest.scala | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') 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 -- cgit v1.2.3