diff --git a/core/shared/src/test/scala/fs2/StreamSuite.scala b/core/shared/src/test/scala/fs2/StreamSuite.scala index 9e3c1133a9..a89d354f34 100644 --- a/core/shared/src/test/scala/fs2/StreamSuite.scala +++ b/core/shared/src/test/scala/fs2/StreamSuite.scala @@ -990,6 +990,14 @@ class StreamSuite extends Fs2Suite { group("parEvalMap") { + test("should preserve element ordering") { + forAllF { (stream: Stream[Pure, Int]) => + val smaller = stream.map(i => math.abs(i % 10)) + val delayed = smaller.covary[IO].parEvalMap(Int.MaxValue)(i => IO.sleep(i.millis).as(i)) + delayed.compile.toList.assertEquals(smaller.toList) + } + } + test("should launch no more than maxConcurrent") { forAllF { (stream: Stream[Pure, Unit], int: Int) => val concurrency = math.abs(int % 20) + 1