Skip to content

Commit

Permalink
Add integration tests for scalac help & print options
Browse files Browse the repository at this point in the history
  • Loading branch information
Gedochao committed May 30, 2022
1 parent f62c012 commit 3b92f58
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1698,4 +1698,51 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
expect(res.out.text(Codec.default).trim == message)
}
}

test("scalac help") {
emptyInputs.fromRoot { root =>
val res1 = os.proc(
TestUtil.cli,
extraOptions,
"--scalac-help"
)
.call(cwd = root, mergeErrIntoOut = true)
expect(res1.exitCode == 0)
expect(res1.out.text().contains("scalac <options> <source files>"))

val res2 = os.proc(
TestUtil.cli,
extraOptions,
"--scalac-option",
"-help"
)
.call(cwd = root, mergeErrIntoOut = true)
expect(res2.exitCode == 0)
expect(res1.out.text() == res2.out.text())
}
}

test("scalac print options") {
emptyInputs.fromRoot { root =>
val printOptionsForAllVersions = Seq("-X", "-Xshow-phases", "-Y")
val printOptionsSince213 = Seq("-V", "-Vphases", "-W")
val version213OrHigher =
actualScalaVersion.startsWith("2.13") || actualScalaVersion.startsWith("3")
val printOptionsToTest = printOptionsForAllVersions ++
(
if (version213OrHigher) printOptionsSince213
else Seq.empty
)
printOptionsToTest.foreach { printOption =>
val res = os.proc(
TestUtil.cli,
extraOptions,
printOption
)
.call(cwd = root, mergeErrIntoOut = true)
expect(res.exitCode == 0)
expect(res.out.text().nonEmpty)
}
}
}
}

0 comments on commit 3b92f58

Please sign in to comment.