@@ -28,13 +28,13 @@ class BashScriptsTests:
2828 printf(" scalac path: [%s]\n " , scalacPath)
2929
3030 lazy val expectedOutput = List (
31- " arg 0:[a]" ,
32- " arg 1:[b]" ,
33- " arg 2:[c]" ,
34- " arg 3:[-repl]" ,
35- " arg 4:[-run]" ,
36- " arg 5:[-script]" ,
37- " arg 6:[-debug]" ,
31+ " arg 0:[a]" ,
32+ " arg 1:[b]" ,
33+ " arg 2:[c]" ,
34+ " arg 3:[-repl]" ,
35+ " arg 4:[-run]" ,
36+ " arg 5:[-script]" ,
37+ " arg 6:[-debug]" ,
3838 )
3939 lazy val testScriptArgs = Seq (
4040 " a" , " b" , " c" , " -repl" , " -run" , " -script" , " -debug"
@@ -56,6 +56,24 @@ class BashScriptsTests:
5656 if fail then
5757 assert(stdout == expectedOutput)
5858
59+ /* verify `dist/bin/scala` with -J setting */
60+ @ Test def verifyScalaJProperty =
61+ val commandline = Seq (scalaPath, " -J-Dkey=World" , " -script" , testFiles.find(_.getName == " envtest.sc" ).get.absPath).mkString(" " )
62+ val (validTest, exitCode, stdout, stderr) = bashCommand(commandline)
63+ assertEquals(stdout.mkString(" \n " ), " Hello World" )
64+
65+ /* verify `dist/bin/scala` with -J setting */
66+ @ Test def verifyScalaJProperty =
67+ val commandline = Seq (scalaPath, " -J-Dkey=World" , " -script" , testFiles.find(_.getName == " envtest.sc" ).get.absPath).mkString(" " )
68+ val (validTest, exitCode, stdout, stderr) = bashCommand(commandline)
69+ assertEquals(stdout.mkString(" \n " ), " Hello World" )
70+
71+ /* verify `dist/bin/scala` with -J setting */
72+ @ Test def verifyScalaJProperty =
73+ val commandline = Seq (scalaPath, " -J-Dkey=World" , testFiles.find(_.getName == " envtest.scala" ).get.absPath).mkString(" " )
74+ val (validTest, exitCode, stdout, stderr) = bashCommand(commandline)
75+ assertEquals(stdout.mkString(" \n " ), " Hello World" )
76+
5977 /* verify `dist/bin/scala` non-interference with command line args following script name */
6078 @ Test def verifyScalaArgs =
6179 val commandline = (Seq (" SCALA_OPTS= " , scalaPath, showArgsScript) ++ testScriptArgs).mkString(" " )
@@ -73,7 +91,7 @@ class BashScriptsTests:
7391 assert(stdout == expectedOutput)
7492
7593 /*
76- * verify that scriptPath.sc sees a valid script.path property,
94+ * verify that scriptPath.sc sees a valid script.path property,
7795 * and that it's value is the path to "scriptPath.sc".
7896 */
7997 @ Test def verifyScriptPathProperty =
@@ -192,7 +210,7 @@ class BashScriptsTests:
192210 val envPairs = testEnvPairs ++ additionalEnvPairs
193211 val proc = Process (cmd, None , envPairs * )
194212 val exitVal = proc ! ProcessLogger (
195- (out : String ) => stdout ::= out,
213+ (out : String ) => stdout ::= out,
196214 (err : String ) => stderr ::= err
197215 )
198216 val validTest = exitVal == 0 && ! stderr.exists(_.contains(" Permission denied" ))
0 commit comments