specs2 integration
Weaver comes with specs2 matchers interop, allowing for matcher style testing.
Installation
You'll need to install an additional dependency in order to use specs2 matchers with Weaver.
SBT
libraryDependencies += "com.disneystreaming" %% "weaver-specs2" % "0.6.7" % Test
Mill
object test extends Tests {
def ivyDeps = Agg(
ivy"com.disneystreaming::weaver-specs2:0.6.7"
)
}
Usage
Add the weaver.specs2compat.IOMatchers
mixin to use specs2 matchers within your test suite.
import weaver.SimpleIOSuite
import weaver.specs2compat.IOMatchers
object MatchersSpec extends SimpleIOSuite with IOMatchers {
pureTest("pureTest { 1 must beEqualTo(1) }") {
1 must beEqualTo(1)
}
pureTest("pureTest { 1 must be_==(1) }") {
1 must be_==(1)
}
pureTest("pureTest { 1 mustEqual 1 }") {
1 mustEqual 1
}
pureTest("pureTest { 1 === 1 }") {
1 === 1
}
pureTest("pureTest { 1 must beEqualTo(1) }") {
1 must beEqualTo(1)
}
pureTest("pureTest { 1 must be_==(1) }") {
1 must be_==(1)
}
pureTest("pureTest { 1 mustEqual 1 }") {
1 mustEqual 1
}
pureTest("pureTest { 1 === 1 }") {
1 === 1
}
pureTest("failure example") {
1 must beEqualTo(2)
}
}
MatchersSpec
+ pureTest { 1 must beEqualTo(1) } 32ms
+ pureTest { 1 must be_==(1) } 26ms
+ pureTest { 1 mustEqual 1 } 2ms
+ pureTest { 1 === 1 } 13ms
+ pureTest { 1 must beEqualTo(1) } 2ms
+ pureTest { 1 must be_==(1) } 2ms
+ pureTest { 1 mustEqual 1 } 2ms
+ pureTest { 1 === 1 } 1ms
- failure example 6ms
*************FAILURES*************
MatchersSpec
- failure example 6ms
1 != 2 (specs2.md:48)
Total 9, Failed 1, Passed 8, Ignored 0, Cancelled 0