diff options
author | Paul Phillips <paulp@improving.org> | 2010-02-03 15:52:25 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-02-03 15:52:25 +0000 |
commit | 909924acba60dadee5647e405c0bb9a2676f4a70 (patch) | |
tree | 717f203151eff1771416d5649539491a6c69a8c1 /test/files/run | |
parent | 0ae8343fd4822ae8c31325e3a9a03ea1a08ee237 (diff) | |
download | scala-909924acba60dadee5647e405c0bb9a2676f4a70.tar.gz scala-909924acba60dadee5647e405c0bb9a2676f4a70.tar.bz2 scala-909924acba60dadee5647e405c0bb9a2676f4a70.zip |
Made sliding/grouped throw an exception when re...
Made sliding/grouped throw an exception when read past the end. Closes
#3017.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/unittest_iterator.scala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/files/run/unittest_iterator.scala b/test/files/run/unittest_iterator.scala index 93aaa4a834..28a548160f 100644 --- a/test/files/run/unittest_iterator.scala +++ b/test/files/run/unittest_iterator.scala @@ -33,5 +33,18 @@ object Test assertThat(1, (1 to 8).toList) { it.sliding(8, 8) withPartial false } assertThat(2, List(9, 10, -1, -1, -1)) { it.sliding(5, 8) withPadding -1 } assertThat(1, (1 to 5).toList) { it.sliding(5, 8) withPartial false } + + // make sure it throws past th end + val thrown = try { + val it = List(1,2,3).sliding(2) + it.next + it.next + it.next + false + } + catch { + case _: NoSuchElementException => true + } + assert(thrown) } } |