可以在sbt控制台中运行并试用specs2吗?我尝试过===,但这不起作用,因为我假设它是规范类中的一种方法。我也试过:
class A extends Specification{ "b" should{ "do" in{ 3 === 4 } } }; (new A).toResult(true) 如果我知道正确的调用方法,values,我怀疑上面的方法会起作用吗?
理想情况下,我希望能够执行单个语句,但如果这是不可能的,有办法运行这种类型的块吗?
PS: specs2是否有不流畅的界面?
发布于 2015-09-20 22:55:01
您可以执行以下操作以在控制台中运行期望:
import org.specs2._, matcher.MustMatchers._, execute._
def t[R:AsResult](r: =>R) = specs2.run(new Specification { def is = p^s2"test $r" })
// then
t(1 === 2)
[info] Specification
[info]
[error] x test
[error] '1' is not equal to '2' (file:1)
[info]
[info] Total for specification Specification
[info] Finished in 5 ms
1 example, 1 failure, 0 error
[info]https://stackoverflow.com/questions/32680336
复制相似问题