标签: scalactic

为什么Scala + Intellij + ScalaTest + Scalactic中的"无法找到隐式"错误,而不是来自sbt

我有这个代码100%来自sbt,执行sbt test但在Intellij Idea中抛出一个编译错误.

import org.scalatest.{BeforeAndAfter, FunSuite, GivenWhenThen}

class SimpleTest extends FunSuite with GivenWhenThen with BeforeAndAfter {
  test("Simple Test") {
    Given("Why this error?")
    assert("ok" === "ok")
  }
}
Run Code Online (Sandbox Code Playgroud)

错误是:

Error:(5, 10) could not find implicit value for parameter pos: org.scalactic.source.Position
    Given("Why this error?")
Error:(5, 10) not enough arguments for method Given: (implicit pos: org.scalactic.source.Position)Unit.
Unspecified value parameter pos.
    Given("Why this error?")
Error:(6, 11) could not find implicit value for parameter prettifier: org.scalactic.Prettifier
    assert("ok" === "ok")
Error:(6, 11) …
Run Code Online (Sandbox Code Playgroud)

scala intellij-idea scalatest scalactic

14
推荐指数
2
解决办法
4741
查看次数

标签 统计

intellij-idea ×1

scala ×1

scalactic ×1

scalatest ×1