gpt4 book ai didi

scala - Specs2 和 scalacheck - 必须通过问题

转载 作者:行者123 更新时间:2023-12-01 11:43:55 25 4
gpt4 key购买 nike

下面的代码片段出现not found: value pass错误。
我是否遗漏了任何导入或此代码对 specs2 无效?

import org.specs2.mutable.Specification
import org.specs2.ScalaCheck
import org.scalacheck.{Prop, Gen}

class TestSpec extends Specification with ScalaCheck {
"Calling test spec" should {
"always pass" in {
val prop = Prop.forAll((a:Int) => true)
prop must pass
}
}
}

最佳答案

must pass 是在原始 specs 中使用的东西项目。使用 specs2 你可以简单地写:

import org.specs2.mutable.Specification
import org.specs2.ScalaCheck
import org.scalacheck.{Prop, Gen}

class TestSpec extends Specification with ScalaCheck {
"Calling test spec" should {
"always pass" in prop { (a:Int) =>
true
}
"with a custom generator" in {
Prop.forAll(smallInteger) { i: Int =>
true
}
}
}
}

关于scala - Specs2 和 scalacheck - 必须通过问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17207297/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com