diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/junit/scala/collection/IteratorTest.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/junit/scala/collection/IteratorTest.scala b/test/junit/scala/collection/IteratorTest.scala index 329c85127a..d980cadeb3 100644 --- a/test/junit/scala/collection/IteratorTest.scala +++ b/test/junit/scala/collection/IteratorTest.scala @@ -192,4 +192,22 @@ class IteratorTest { assertSameElements(exp, res) assertEquals(8, counter) // was 14 } + + // SI-9766 + @Test def exhaustedConcatIteratorConcat: Unit = { + def consume[A](i: Iterator[A]) = { + while(i.hasNext) i.next() + } + val joiniter = Iterator.empty ++ Seq(1, 2, 3) + assertTrue(joiniter.hasNext) + consume(joiniter) + val concatiter = joiniter ++ Seq(4, 5, 6) + assertTrue(concatiter.hasNext) + consume(concatiter) + assertFalse(concatiter.hasNext) + val concatFromEmpty = concatiter ++ Seq(7, 8, 9) + assertTrue(concatFromEmpty.hasNext) + consume(concatFromEmpty) + assertFalse(concatFromEmpty.hasNext) + } } |