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)
expect(Some(25).contains(5))
Use the `clue` function to troubleshoot
funsuite.md:11
test("fails") { expect(Some(25).contains(5)) }
^ - 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:217 scala.util.Try$#apply
Test.scala:31 weaver.Test$#pure
suites.scala:225 weaver.FunSuiteF#$anonfun$test$1
suites.scala:182 weaver.SharedResourceSuite#$anonfun$spec$2
List.scala:251 scala.collection.immutable.List#map
List.scala:79 scala.collection.immutable.List#map
suites.scala:182 weaver.SharedResourceSuite#$anonfun$spec$1
Stream.scala:1294 fs2.Stream#$anonfun$flatMap$1
Pull.scala:1052 fs2.Pull$FlatMapR$1#loop$1
Pull.scala:1059 fs2.Pull$FlatMapR$1#go$2
Pull.scala:1069 fs2.Pull$FlatMapR$1#unconsed
Pull.scala:1078 fs2.Pull$FlatMapR$1#out
Pull.scala:977 fs2.Pull$ViewRunner$1#outLoop$1
Pull.scala:979 fs2.Pull$ViewRunner$1#out
Pull.scala:1236 fs2.Pull$#$anonfun$compile$24
Pull.scala:952 fs2.Pull$#$anonfun$compile$2
IOFiber.scala:1235 cats.effect.IOFiber#succeeded
IOFiber.scala:259 cats.effect.IOFiber#runLoop
IOFiber.scala:1397 cats.effect.IOFiber#execR
IOFiber.scala:122 cats.effect.IOFiber#run
WorkerThread.scala:935 cats.effect.unsafe.WorkerThread#run Total 3, Failed 2, Passed 1, Ignored 0