gpt4 book ai didi

Scala 的 simple-build-tool 似乎无法运行测试

转载 作者:行者123 更新时间:2023-12-01 04:18:34 24 4
gpt4 key购买 nike

我已经使用 sbt 创建了一个项目,并对其进行了配置:

val scalatest = "org.scala-tools.testing" % "scalatest" % "0.9.5" % "test"

然后我粘贴了来自 ScalaTest 的示例进入一个文件并运行“sbt test”以查看它是否正常工作。文件编译,但测试从未执行。

据我所知,这很简单。我错过了什么吗?

最佳答案

首先,根据他们的网站,我相信 1.0 是正确的版本。我的 project/build/def.scala看起来像这样:

import sbt._

class Tests(info: ProjectInfo) extends DefaultProject(info) {
val scalatest = "org.scalatest" % "scalatest" % "1.0" % "test"
}

然后做一个 sbt update ,然后是 sbt reload (不确定是否需要重新加载,但不会造成伤害)

现在在 /src/test/scala , 使用他们的例子但也导入 scala.collection.mutable.Stacksbt test对我来说很好用
jcdavis@seam-carver:~/dev/test2$ sbt test
[info] Building project test 1.0 using Tests
[info] with sbt 0.5.6 and Scala 2.7.7
[info]
[info] == compile ==
[info] Source analysis: 0 new/modified, 0 indirectly invalidated, 0 removed.
[info] Compiling main sources...
[info] Nothing to compile.
[info] Post-analysis: 0 classes.
[info] == compile ==
[info]
[info] == copy-test-resources ==
[info] == copy-test-resources ==
[info]
[info] == copy-resources ==
[info] == copy-resources ==
[info]
[info] == test-compile ==
[info] Source analysis: 0 new/modified, 0 indirectly invalidated, 0 removed.
[info] Compiling test sources...
[info] Nothing to compile.
[info] Post-analysis: 4 classes.
[info] == test-compile ==
[info]
[info] == test-start ==
[info] == test-start ==
[info]
[info] == StackSpec ==
[info] A Stack
[info] Test Starting - A Stack should pop values in last-in-first-out order
[info] Test Succeeded - A Stack should pop values in last-in-first-out order
[info] Test Starting - A Stack should throw NoSuchElementException if an empty stack is popped
[info] Test Succeeded - A Stack should throw NoSuchElementException if an empty stack is popped
[info] == StackSpec ==
[info]
[info] == test-complete ==
[info] == test-complete ==
[info]
[info] == test-finish ==
[info] Run: 2, Passed: 2, Errors: 0, Failed: 0
[info]
[info] All tests PASSED.
[info] == test-finish ==
[info]
[info] == test-cleanup ==
[info] == test-cleanup ==
[info]
[info] == test ==
[info] == test ==
[success] Successful.

关于Scala 的 simple-build-tool 似乎无法运行测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2691253/

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