Skip to content

Commit

Permalink
Add tests for commas being no longer accepted as using directive valu…
Browse files Browse the repository at this point in the history
…e separators on their own, and being deprecated otherwise
  • Loading branch information
Gedochao committed Nov 29, 2024
1 parent 8aaf31d commit 1ae6722
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ trait CompileScalacCompatTestDefinitions { _: CompileTestDefinitions =>
),
Seq(
Seq(s"${dashPrefix}color:never"),
Seq(s"\"${dashPrefix}language:noAutoTupling,strictEquality\"")
Seq(s"${dashPrefix}language:noAutoTupling,strictEquality")
),
Seq(
Seq(s"${dashPrefix}color", "never"),
Seq(s"${dashPrefix}language", "\"noAutoTupling,strictEquality\"")
Seq(s"${dashPrefix}language", "noAutoTupling,strictEquality")
)
)
(cliOpts, directiveOpts) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,34 @@ class RunTestsDefault extends RunTestDefinitions
.call(cwd = root)
}
}

test("meaningful commas dont have to be escaped in using directive values") {
val inputPath = os.rel / "example.scala"
TestInputs(inputPath ->
"""//> using dep tabby:tabby:0.2.3,url=https://github.com/bjornregnell/tabby/releases/download/v0.2.3/tabby_3-0.2.3.jar
|import tabby.Grid
|@main def main = println(Grid("a", "b", "c")(1, 2, 3))
|""".stripMargin).fromRoot { root =>
val res = os.proc(TestUtil.cli, "run", extraOptions, inputPath)
.call(cwd = root)
val out = res.out.trim()
expect(out.contains("a, b, c"))
}
}

test(
"using directives using commas with space as separators should produce a deprecation warning."
) {
val inputPath = os.rel / "example.sc"
TestInputs(inputPath ->
"""//> using options -Werror, -Wconf:cat=deprecation:e
|println("Deprecation warnings should have been printed")
|""".stripMargin)
.fromRoot { root =>
val res = os.proc(TestUtil.cli, "run", extraOptions, inputPath)
.call(cwd = root, stderr = os.Pipe)
val err = res.err.trim()
expect(err.contains("Use of commas as separators is deprecated"))
}
}
}

0 comments on commit 1ae6722

Please sign in to comment.