summaryrefslogtreecommitdiff
path: root/test/junit/scala/collection/IteratorTest.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/junit/scala/collection/IteratorTest.scala')
-rw-r--r--test/junit/scala/collection/IteratorTest.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/junit/scala/collection/IteratorTest.scala b/test/junit/scala/collection/IteratorTest.scala
index cb7cbb40bc..b7a9805c9f 100644
--- a/test/junit/scala/collection/IteratorTest.scala
+++ b/test/junit/scala/collection/IteratorTest.scala
@@ -17,4 +17,12 @@ class IteratorTest {
slidingIt.next
assertEquals("Counter should be one, that means we didn't look further than needed", 1, counter)
}
+
+ @Test def groupedIteratorIsLazyWhenPadded(): Unit = {
+ var counter = 0
+ def it = new Iterator[Int] { var i = 0 ; def hasNext = { counter = i; true } ; def next = { i += 1; i } }
+ val slidingIt = it sliding 2 withPadding -1
+ slidingIt.next
+ assertEquals("Counter should be one, that means we didn't look further than needed", 1, counter)
+ }
}