Is it possible to run and try out specs2 in an sbt console? I tried === but that did not work because I assume it is a method in Specification class. I also tried:
class A extends Specification{ "b" should{ "do" in{ 3 === 4 } } }; (new A).toResult(true)
I'm suspecting the above should work if I know the right method to call, values
?
Ideally I'd like it if I can execute single statements but if that is not possible, is there a way to run blocks of this sort?
PS: Is there a non-Fluent interface to specs2?
You can do the following to run expectations in the console:
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]