报告可以使用 specs2 中的内置匹配器。
示例:
class TestSpec extends Specification { def is = s2"""
This is a spec
opt
should contain 1 $e1
"""
def e1 = {
val opt = Some(1)
opt must equalTo (Some(1))
}
}
在应用快速修复后:
class TestSpec extends Specification { def is = s2"""
This is a spec
opt
should contain 1 $e1
"""
def e1 = {
val opt = Some(1)
opt must beSome(1)
}
}