Specs2给定时间简单测试失败

时间:2014-04-28 06:48:12

标签: scala specs2

我有一个简单的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 ........

非常感谢提前。

1 个答案:

答案 0 :(得分:1)

我认为语法已经改变,你必须混合GWT特性。

查看documentation

相关问题