【问题标题】:Specs2 Given when then A simple test failedSpecs2 Given when then 一个简单的测试失败了
【发布时间】: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 ........

非常感谢。

【问题讨论】:

    标签: scala specs2


    【解决方案1】:

    我相信语法已经改变,你必须混入 GWT 特征。

    看看documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-20
      • 1970-01-01
      相关资源
      最近更新 更多