scala - 为什么不 scalatest 编译?
问题描述
我有一个简单的测试设置,比如
package unit
import net.kolotyluk.leaderboard.scorekeeping._
import net.kolotyluk.leaderboard.telemetry.Metrics
import net.kolotyluk.scala.extras.Logging
import org.scalatest.{FlatSpec, GivenWhenThen, Matchers, SequentialNestedSuiteExecution}
import scala.collection.mutable.ArrayBuffer
import scala.concurrent.{Await,Future}
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.{Failure, Random, Success}
class LeaderboardSpec
extends FlatSpec
with SequentialNestedSuiteExecution
with GivenWhenThen
with Matchers
with Logging {
behavior of "Leaderboard"
it must "handle initial conditions correctly" in {
但是当我尝试编译我的测试时,我得到了 53 个错误,比如
[IJ]sbt:leaderboard> test
[info] Compiling 1 Scala source to C:\Users\ERIC\Documents\git\repos\leaderboard\target\scala-2.12\test-classes ...
[error] C:\Users\ERIC\Documents\git\repos\leaderboard\src\test\scala\unit\LeaderboardSpec.scala:21:12: could not find implicit value for parameter pos: org.scalactic.source.Position
[error] behavior of "Leaderboard"
[error] ^
这实际上并没有传达任何有关问题所在的有用信息。我只能假设在我的 build.sbt 文件或其他地方没有正确配置某些东西。
这段代码确实曾经工作过,在我清理东西的过程中,事情发生了变化,现在它在没有良好诊断的情况下被破坏了。
任何人都可以建议要寻找的东西吗?
解决方案
因此,似乎可以正确编译和运行的一种解决方法是停止使用 SBT 并改用 Maven。
我认为这是迄今为止我在 SBT 中发现的第三个主要缺陷。
推荐阅读
- python - 独立 R 脚本加载依赖项的性能
- drupal - Drupal 8 来宾用户访问节点
- r - 枢轴更宽会产生嵌套对象
- google-cloud-platform - 为通过 GCP UI 创建的集群获取 gcloud create cmd
- android - HttpURLConnection 适用于模拟器,但不适用于 USB 连接设备
- laravel - 在计划之前检查并比较日期
- javascript - 在父级上使用 transform:scale 时,子元素的下拉菜单位于另一行下方
- c++ - 在没有模板化类的情况下存储 lambda
- r - 绘制具有特定值的密度函数
- azure - 如何使用 Terraform 输出 Cosmos DB 连接字符串