From 65dbb6d8b97bd5995a7e0fec3e16812d42c17e86 Mon Sep 17 00:00:00 2001 From: Matthias Berndt Date: Wed, 10 Apr 2024 22:30:36 +0200 Subject: [PATCH] improve `checkComplexResidual` test --- src/sbt-test/ash/command-line-settings/build.sbt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sbt-test/ash/command-line-settings/build.sbt b/src/sbt-test/ash/command-line-settings/build.sbt index 1dfc9e035..4ed99facd 100644 --- a/src/sbt-test/ash/command-line-settings/build.sbt +++ b/src/sbt-test/ash/command-line-settings/build.sbt @@ -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')") }