Skip to content

Commit

Permalink
make stack-safety-test for tailRecM in MonadTests only fail when chec…
Browse files Browse the repository at this point in the history
…king the test

Previously, already calling 'MonadTests[Signal].monad[Int, Int, Int].all' would cause a StackOverflowError, now this is only caused when executing the test and can be captured e.g. by using check.

In our case, this solved a ScalaTest test suite from aborting and thus not executing any tests to just a failing test.
  • Loading branch information
fabianschmitthenner committed Dec 29, 2016
1 parent 974b840 commit bf2bc13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion laws/src/main/scala/cats/laws/discipline/MonadTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ trait MonadTests[F[_]] extends ApplicativeTests[F] with FlatMapTests[F] {
"monad left identity" -> forAll(laws.monadLeftIdentity[A, B] _),
"monad right identity" -> forAll(laws.monadRightIdentity[A] _),
"map flatMap coherence" -> forAll(laws.mapFlatMapCoherence[A, B] _)
) ++ (if (Platform.isJvm) Seq[(String, Prop)]("tailRecM stack safety" -> laws.tailRecMStackSafety) else Seq.empty)
) ++ (if (Platform.isJvm) Seq[(String, Prop)]("tailRecM stack safety" -> Prop.lzy(laws.tailRecMStackSafety)) else Seq.empty)
}
}

Expand Down

0 comments on commit bf2bc13

Please sign in to comment.