mirror of https://github.com/sbt/sbt.git
test: Add tests for --version flag (#8717)
This commit is contained in:
parent
9fd98e006a
commit
34276cc90d
|
|
@ -123,6 +123,27 @@ object ExtendedRunnerTest extends BasicTestSuite:
|
|||
()
|
||||
}
|
||||
|
||||
test("sbt --version in empty directory") {
|
||||
IO.withTemporaryDirectory { tmp =>
|
||||
val out = sbtProcessInDir(tmp)("--version").!!
|
||||
assert(out.contains("sbt runner version:"))
|
||||
assert(out.contains("[info] sbt runner (sbt-the-shell-script)"))
|
||||
}
|
||||
()
|
||||
}
|
||||
|
||||
test("sbt --version in sbt 2.x project directory (#8717)") {
|
||||
IO.withTemporaryDirectory { tmp =>
|
||||
IO.write(tmp / "build.sbt", "")
|
||||
IO.write(tmp / "project" / "build.properties", "sbt.version=2.0.0-RC8")
|
||||
val out = sbtProcessInDir(tmp)("--version").!!
|
||||
assert(out.contains("sbt version in this project: 2.0.0-RC8"))
|
||||
assert(out.contains("sbt runner version:"))
|
||||
assert(out.contains("[info] sbt runner (sbt-the-shell-script)"))
|
||||
}
|
||||
()
|
||||
}
|
||||
|
||||
test("sbt --jvm-client") {
|
||||
val out = sbtProcess("--jvm-client", "--no-colors", "compile").!!.linesIterator.toList
|
||||
if (isWindows) {
|
||||
|
|
|
|||
|
|
@ -129,6 +129,25 @@ object RunnerScriptTest extends verify.BasicTestSuite with ShellScriptUtil:
|
|||
assert(out.mkString(System.lineSeparator()).trim.matches(expectedVersion))
|
||||
()
|
||||
|
||||
testOutput(
|
||||
"sbt --version should work (sbt 1.x project)",
|
||||
citestVariant = "citest",
|
||||
)("--version"): (out: List[String]) =>
|
||||
val output = out.mkString(System.lineSeparator())
|
||||
assert(output.contains("sbt runner version:"))
|
||||
assert(output.contains("[info] sbt runner (sbt-the-shell-script)"))
|
||||
()
|
||||
|
||||
testOutput(
|
||||
"sbt --version should work (sbt 2.x project) (#8717)",
|
||||
citestVariant = "citest2",
|
||||
)("--version"): (out: List[String]) =>
|
||||
val output = out.mkString(System.lineSeparator())
|
||||
assert(output.contains("sbt version in this project:"))
|
||||
assert(output.contains("sbt runner version:"))
|
||||
assert(output.contains("[info] sbt runner (sbt-the-shell-script)"))
|
||||
()
|
||||
|
||||
testOutput("--sbt-cache")("--sbt-cache", "./cachePath"): (out: List[String]) =>
|
||||
assert(out.contains[String]("-Dsbt.global.localcache=./cachePath"))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue