summaryrefslogtreecommitdiff
path: root/test/files/run/unittest_iterator.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-05-18 19:52:51 +0000
committerPaul Phillips <paulp@improving.org>2010-05-18 19:52:51 +0000
commit1b06a599ca7d79557e47e9f8ae37fa9fa07979c0 (patch)
tree44921033df6341a4a9ba7b0b5ce0b8fe224484b2 /test/files/run/unittest_iterator.scala
parenta3bbcdbfc69004caf2025388f7f6dbb068419968 (diff)
downloadscala-1b06a599ca7d79557e47e9f8ae37fa9fa07979c0.tar.gz
scala-1b06a599ca7d79557e47e9f8ae37fa9fa07979c0.tar.bz2
scala-1b06a599ca7d79557e47e9f8ae37fa9fa07979c0.zip
Fix for sliding boundary condition.
Diffstat (limited to 'test/files/run/unittest_iterator.scala')
-rw-r--r--test/files/run/unittest_iterator.scala9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/files/run/unittest_iterator.scala b/test/files/run/unittest_iterator.scala
index 28a548160f..21dc64c3c5 100644
--- a/test/files/run/unittest_iterator.scala
+++ b/test/files/run/unittest_iterator.scala
@@ -1,6 +1,5 @@
// Some iterator grouped/sliding unit tests
-object Test
-{
+object Test {
def it = (1 to 10).iterator
def assertThat[T](expectedLength: Int, expectedLast: Seq[T])(it: Iterator[Seq[T]]) {
val xs = it.toList
@@ -34,7 +33,11 @@ object Test
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
+ // larger step than window
+ assertThat(5, List(9)) { it.sliding(1, 2) }
+ assertThat(3, List(9, 10)) { it.sliding(2, 4) }
+
+ // make sure it throws past the end
val thrown = try {
val it = List(1,2,3).sliding(2)
it.next