Skip to content

Commit

Permalink
Add test for typelevel#2842
Browse files Browse the repository at this point in the history
  • Loading branch information
armanbilge committed Mar 10, 2022
1 parent fad328c commit 56582bf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion core/shared/src/test/scala/fs2/StreamInterruptSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package fs2

import scala.concurrent.duration._

import cats.effect.{IO, Sync}
import cats.effect.{IO, IOLocal, Sync}
import cats.effect.kernel.Deferred
import cats.effect.std.Semaphore
import org.scalacheck.effect.PropF.forAllF
Expand Down Expand Up @@ -369,4 +369,15 @@ class StreamInterruptSuite extends Fs2Suite {
val interrupt = IO.sleep(250.millis)
IO.race(compileWithSync(s).drain, interrupt).map(_.isRight).assert
}

test("issue #2842 - no interrupt scope") {
val s = Stream.eval(IOLocal(List.empty[Int])).flatMap { local =>
Stream.eval(local.update(1 :: _)).flatMap { _ =>
Stream.eval(local.update(2 :: _)).flatMap { _ =>
Stream.eval(local.get)
}
}
}
s.interruptScope.compile.lastOrError.assertEquals(List(2, 1))
}
}

0 comments on commit 56582bf

Please sign in to comment.