Skip to content

Commit

Permalink
improve checkComplexResidual test
Browse files Browse the repository at this point in the history
  • Loading branch information
mberndt123 committed Apr 10, 2024
1 parent 66e7c29 commit 65dbb6d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sbt-test/ash/command-line-settings/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ TaskKey[Unit]("checkResidual") := {
}

TaskKey[Unit]("checkComplexResidual") := {
val args = Seq("--", "arg1", "arg 2", "--", "\"", "$foo", "'", "%s", "-y", "bla", "\\'", "\\\"")
val args = Seq("-J-Dfoo=bar", "arg1", "--", "-J-Dfoo=bar", "arg 2", "--", "\"", "$foo", "'", "%s", "-y", "bla", "\\'", "\\\"")
val cwd = (stagingDirectory in Universal).value
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath) ++ args
val expected = """arg1|-J-Dfoo=bar|arg 2|--|"|$foo|'|%s|-y|bla|\'|\""""

val output = (sys.process.Process(cmd, cwd).!!).replaceAll("\n", "")
assert(output.contains(args.drop(1).mkString("|")), s"Application did not receive residual args '$args' ('$output')")
val output = (sys.process.Process(cmd, cwd).!!).split("\n").last
assert(output == expected, s"Application did not receive residual args '$expected' (got '$output')")
}

0 comments on commit 65dbb6d

Please sign in to comment.