diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2016-05-23 16:36:23 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2016-05-23 16:36:23 +0200 |
commit | f640fa0a6d01270b4c16238073c154bf0e71b559 (patch) | |
tree | 7bc58ad05effbdfa7653fea52cf12e8780fb6d7e /test/junit | |
parent | 41965695b71bc00ea60003c39c72a0e10bfd621f (diff) | |
parent | c89c36597f922fe29cbb3cec8095611f86ba4976 (diff) | |
download | scala-f640fa0a6d01270b4c16238073c154bf0e71b559.tar.gz scala-f640fa0a6d01270b4c16238073c154bf0e71b559.tar.bz2 scala-f640fa0a6d01270b4c16238073c154bf0e71b559.zip |
Merge pull request #5167 from martijnhoekstra/SI-9766
SI 9766 - allow ++ on empty ConcatIterator
Diffstat (limited to 'test/junit')
-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) + } } |