Merge pull request #6316 from eed3si9n/wip/munit

Fix "-Yrangepos" disappearing from Test / scalacOptions
This commit is contained in:
eugene yokota 2021-02-17 07:19:18 -05:00 committed by GitHub
commit 6dc1327855
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 3 deletions

View File

@ -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)

View File

@ -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"),
)

View File

@ -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)
}
}
}

View File

@ -0,0 +1 @@
> test