Skip to content

Commit

Permalink
test from issue 2950
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenvariable committed Nov 3, 2022
1 parent d30be68 commit 59d8fbb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/shared/src/test/scala/cats/tests/ContTSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@ class ContTSuite extends CatsSuite {
assert(contT.run(Eval.now(_)).value === maxIters)
}

// test from issue 2950
test("ContT.map stack-safety") {
val maxIters = 20000
var k = ContT.defer[Eval, Int, Int](0)
for (_ <- 1 to maxIters) {
k = k.map(x => x + 1)
}
assert(k.run(_.pure[Eval]).value == maxIters)
}

test("ContT.callCC short-circuits and invokes the continuation") {
forAll { (cb: Unit => Eval[Int]) =>
var shouldNotChange = false
Expand Down

0 comments on commit 59d8fbb

Please sign in to comment.