我在 Scala (v2.9.1) 上使用 specs2 (v1.8.2) 来编写验收测试。按照http://etorreborre.github.com/specs2/guide/org.specs2.guide.SpecStructure.html#Contexts的示例,我有以下规范和上下文案例类:
import org.specs2._
class testspec extends SpecificationWithJUnit { def is =
"test should" ^
"run a test in a context" ! context().e1
}
case class context() {
def e1 = 1 must beEqualTo(1)
}
我得到一个编译器错误:
错误:值必须不是 Int def e1 = 1 must beEqualTo(1) 的成员
编译上下文案例类时。
显然我是 specs2(和 Scala)的新手。对适当文档的引用将不胜感激。