Skip to content

Commit c4dcfe7

Browse files
committed
fix misleading method name in test
1 parent c89574a commit c4dcfe7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/test/scala/scala/collection/immutable/TestLazyListExtensions.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import next._
2020
class TestLazyListExtensions {
2121

2222
// This method will *not* terminate for non-cyclic infinite-sized collections.
23-
def assertIsCyclical[T](xs: LazyList[T]): Unit = {
24-
assertTrue(xs.nonEmpty)
23+
def assertConstantMemory[T](xs: LazyList[T]): Unit =
24+
// `force` does cycle detection, so if this terminates, the collection is
25+
// either finite or a cycle
2526
xs.force
26-
}
2727

2828
@Test
2929
def testEmpty1(): Unit = {
@@ -46,7 +46,7 @@ class TestLazyListExtensions {
4646
val xs = LazyList(1, 2, 3)
4747
val cyc = xs.cycle
4848
assertFalse(cyc.isEmpty)
49-
assertIsCyclical(cyc)
49+
assertConstantMemory(cyc)
5050
assertEquals(LazyList(1, 2, 3, 1, 2, 3, 1, 2), cyc.take(8))
5151
}
5252
@Test
@@ -88,13 +88,13 @@ class TestLazyListExtensions {
8888
def testConstantMemory3(): Unit = {
8989
val xs = LazyList(1, 2, 3)
9090
val cyc = xs.cycle
91-
assertIsCyclical(cyc)
92-
assertIsCyclical(cyc.tail)
93-
assertIsCyclical(cyc.tail.tail)
94-
assertIsCyclical(cyc.tail.tail.tail)
95-
assertIsCyclical(cyc.tail.tail.tail.tail)
96-
assertIsCyclical(cyc.drop(1))
97-
assertIsCyclical(cyc.drop(10))
91+
assertConstantMemory(cyc)
92+
assertConstantMemory(cyc.tail)
93+
assertConstantMemory(cyc.tail.tail)
94+
assertConstantMemory(cyc.tail.tail.tail)
95+
assertConstantMemory(cyc.tail.tail.tail.tail)
96+
assertConstantMemory(cyc.drop(1))
97+
assertConstantMemory(cyc.drop(10))
9898
}
9999
@Test
100100
def testUnbounded(): Unit = {

0 commit comments

Comments
 (0)