0
使用SBT測試代碼SBT項目找不到ScalaCheck
package examples
import org.specs2._
class ScalaCheckExamplesSpec extends Specification with ScalaCheck { def is = s2"""
startsWith ${ prop { (a: String, b: String) => (a+b) must startWith(a) } }
endsWith ${ prop { (a: String, b: String) => (a+b) must endWith(b) } }
substring ${ prop { (a: String, b: String) => (a+b).substring(a.length) === b } }
substring ${ prop { (a: String, b: String, c: String) => (a+b+c).substring(a.length, a.length+b.length) === b } } """
}
與SBT配置:
libraryDependencies ++= Seq(
"org.specs2" %% "specs2-core" % "3.8.5" % "test",
"org.scalacheck" %% "scalacheck" % "1.13.4" % "test"
)
類ScalaCheck
無法找到:
ScalaCheckExamplesSpec.scala:11: not found: type ScalaCheck
[error] class ScalaCheckExamplesSpec extends Specification with ScalaCheck {
我該如何解決錯誤?
是否使用Scala的2.12? – Pavel
使用版本2.11.6,但未在build.sbt – Johan