我有一个简单的specs2 Given When Then测试案例来自(A simple Scala Given/When/Then style specification failed)。代码无法编译。我不知道为什么会这样。 代码:
class Specs2Spec extends Specification { def is =
"addition" ^
"given first number: ${1}" ^ number1 ^
"when add another number: ${2}" ^ number2 ^
"Then the result is: ${3}" ^ result ^
end
lazy val number1: Given[Int] = (_: String).toInt
lazy val number2: When[Int, (Int, Int)] = (n1: Int) => (s: String) => (n1, s.toInt)
lazy val result: Then[(Int, Int)] = (n: (Int, Int)) => (s: String) => (n._1 + n._2) must_== s.toInt
}
错误: 错误:(8,39)重载方法值^与替代品: (a:org.specs2.main.Arguments)org.specs2.specification.Fragments ........
非常感谢提前。