【发布时间】:2014-04-28 19:26:17
【问题描述】:
我有一个简单的 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 ........
非常感谢。
【问题讨论】: