Pure tests
If your tests do not require any capability provided by effect-types, you can use a simplified interface FunSuite
,
which comes with a single test
method and does not allow effectful tests.
Tests in FunSuite
are executed sequentially and without the performance overhead of effect
management.
object CatsFunSuite extends weaver.FunSuite {
test("asserts") { expect(Some(5).contains(5)) }
test("fails") { expect(Some(25).contains(5)) }
test("throws") { throw new RuntimeException("oops") }
}
repl.MdocSessionMdocAppCatsFunSuite + asserts 0ms - fails 0ms - throws 0ms *************FAILURES************* repl.MdocSessionMdocAppCatsFunSuite - fails 0ms
assertion failed (funsuite.md:11) - throws 0ms
RuntimeException: oops
funsuite.md:13 repl.MdocSession$MdocApp$CatsFunSuite$$anonfun$3#apply
funsuite.md:13 repl.MdocSession$MdocApp$CatsFunSuite$$anonfun$3#apply
Try.scala:210 scala.util.Try$#apply
Test.scala:31 weaver.Test$#pure
suites.scala:187 weaver.FunSuiteF#$anonfun$test$1
suites.scala:197 weaver.FunSuiteF#$anonfun$pureSpec$1
List.scala:250 scala.collection.immutable.List#map
List.scala:79 scala.collection.immutable.List#map
suites.scala:197 weaver.FunSuiteF#pureSpec
suites.scala:201 weaver.FunSuiteF#spec
Runner.scala:33 weaver.Runner#$anonfun$run$5
Stream.scala:2344 fs2.Stream#$anonfun$parEvalMapActionImpl$10
ApplicativeError.scala:269 cats.ApplicativeError#catchNonFatal
ApplicativeError.scala:268 cats.ApplicativeError#catchNonFatal$
IO.scala:1769 cats.effect.IO$$anon$5#catchNonFatal
Stream.scala:2344 fs2.Stream#$anonfun$parEvalMapActionImpl$9
IOFiber.scala:1200 cats.effect.IOFiber#succeeded
IOFiber.scala:351 cats.effect.IOFiber#runLoop
IOFiber.scala:1362 cats.effect.IOFiber#execR
IOFiber.scala:112 cats.effect.IOFiber#run
WorkerThread.scala:743 cats.effect.unsafe.WorkerThread#run Total 3, Failed 2, Passed 1, Ignored 0, Cancelled 0