mirror of https://github.com/sbt/sbt.git
Merge pull request #6316 from eed3si9n/wip/munit
Fix "-Yrangepos" disappearing from Test / scalacOptions
This commit is contained in:
commit
6dc1327855
|
|
@ -70,9 +70,11 @@ object SemanticdbPlugin extends AutoPlugin {
|
|||
targetRootOptions(scalaVersion.value, semanticdbTargetRoot.value),
|
||||
scalacOptions --= Def.settingDyn {
|
||||
val config = configuration.value
|
||||
Def.setting {
|
||||
semanticdbOptions.?.all(ancestorConfigs(config)).value.flatten.flatten
|
||||
}
|
||||
val enabled = semanticdbEnabled.value
|
||||
if (enabled)
|
||||
Def.setting {
|
||||
semanticdbOptions.?.all(ancestorConfigs(config)).value.flatten.flatten
|
||||
} else Def.setting { Nil }
|
||||
}.value,
|
||||
scalacOptions ++= {
|
||||
if (semanticdbEnabled.value)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
ThisBuild / scalaVersion := "2.12.12"
|
||||
|
||||
lazy val munit = "org.scalameta" %% "munit" % "0.7.22"
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.settings(
|
||||
Compile / scalacOptions += "-Yrangepos",
|
||||
libraryDependencies += munit % Test,
|
||||
testFrameworks += new TestFramework("munit.Framework"),
|
||||
)
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package testpkg
|
||||
|
||||
import munit._
|
||||
|
||||
class ClueSuite extends FunSuite {
|
||||
val x = 42
|
||||
val y = 32
|
||||
checkPrint(
|
||||
"clues",
|
||||
clues(x, y),
|
||||
"""|Clues {
|
||||
| x: Int = 42
|
||||
| y: Int = 32
|
||||
|}
|
||||
|""".stripMargin
|
||||
)
|
||||
|
||||
val z: List[Int] = List(1)
|
||||
checkPrint(
|
||||
"list",
|
||||
clues(z),
|
||||
"""|Clues {
|
||||
| z: List[Int] = List(
|
||||
| 1
|
||||
| )
|
||||
|}
|
||||
|""".stripMargin
|
||||
)
|
||||
|
||||
def checkPrint(
|
||||
options: TestOptions,
|
||||
clues: Clues,
|
||||
expected: String
|
||||
)(implicit loc: Location): Unit = {
|
||||
test(options) {
|
||||
val obtained = munitPrint(clues)
|
||||
assertNoDiff(obtained, expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
> test
|
||||
Loading…
Reference in New Issue