diff --git a/tests/src/test/scala/cats/tests/StreamingTests.scala b/tests/src/test/scala/cats/tests/StreamingTests.scala index e4eff26282..86bd1fd69b 100644 --- a/tests/src/test/scala/cats/tests/StreamingTests.scala +++ b/tests/src/test/scala/cats/tests/StreamingTests.scala @@ -43,6 +43,18 @@ class AdHocStreamingTests extends CatsSuite { } } + test("results aren't reevaluated after memoize") { + forAll { (orig: Streaming[Int]) => + val size = orig.toList.size + var i = 0 + val memoized = orig.map(_ => i += 1).memoize + memoized.toList + i should === (size) + memoized.toList + i should === (size) + } + } + // convert (A => List[B]) to (A => Streaming[B]) def convertF[A, B](f: A => List[B]): A => Streaming[B] = (a: A) => Streaming.fromList(f(a))