Skip to content

Commit 7b14031

Browse files
committed
fix-for-#12962
1 parent 79fae19 commit 7b14031

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

compiler/test/dotty/tools/scripting/BashScriptsTests.scala

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -41,39 +41,42 @@ class BashScriptsTests:
4141

4242
/* verify `dist/bin/scalac` */
4343
@Test def verifyScalacArgs =
44-
val commandline = (Seq(scalacPath, "-script", showArgsScript) ++ testScriptArgs).mkString(" ")
45-
if bashPath.toFile.exists then
46-
var cmd = Array(bashExe, "-c", commandline)
47-
val output = for {
48-
line <- Process(cmd).lazyLines_!
49-
} yield line
50-
var fail = false
51-
printf("\n")
52-
for (line, expect) <- output zip expectedOutput do
53-
printf("expected: %-17s| actual: %s\n", line, expect)
54-
if line != expect then
55-
fail = true
56-
57-
if fail then
58-
assert(output == expectedOutput)
44+
if scalacPath.nonEmpty then
45+
printf("scalacPath[%s]\n",scalacPath)
46+
val commandline = (Seq(scalacPath, "-script", showArgsScript) ++ testScriptArgs).mkString(" ")
47+
if bashPath.toFile.exists then
48+
var cmd = Array(bashExe, "-c", commandline)
49+
val output = for {
50+
line <- Process(cmd).lazyLines_!
51+
} yield line
52+
var fail = false
53+
printf("\n")
54+
for (line, expect) <- output zip expectedOutput do
55+
printf("expected: %-17s\nactual : %s\n", expect, line)
56+
if line != expect then
57+
fail = true
58+
59+
if fail then
60+
assert(output == expectedOutput)
5961

6062
/* verify `dist/bin/scala` */
6163
@Test def verifyScalaArgs =
62-
val commandline = (Seq(scalaPath, showArgsScript) ++ testScriptArgs).mkString(" ")
63-
if bashPath.toFile.exists then
64-
var cmd = Array(bashExe, "-c", commandline)
65-
val output = for {
66-
line <- Process(cmd).lazyLines_!
67-
} yield line
68-
var fail = false
69-
printf("\n")
70-
for (line, expect) <- output zip expectedOutput do
71-
printf("expected: %-17s| actual: %s\n", line, expect)
72-
if line != expect then
73-
fail = true
74-
75-
if fail then
76-
assert(output == expectedOutput)
64+
if scalaPath.nonEmpty then
65+
val commandline = (Seq(scalaPath, showArgsScript) ++ testScriptArgs).mkString(" ")
66+
if bashPath.toFile.exists then
67+
var cmd = Array(bashExe, "-c", commandline)
68+
val output = for {
69+
line <- Process(cmd).lazyLines_!
70+
} yield line
71+
var fail = false
72+
printf("\n")
73+
for (line, expect) <- output zip expectedOutput do
74+
printf("expected: %-17s\nactual : %s\n", expect, line)
75+
if line != expect then
76+
fail = true
77+
78+
if fail then
79+
assert(output == expectedOutput)
7780

7881
extension (str: String) def dropExtension =
7982
str.reverse.dropWhile(_ != '.').drop(1).reverse

0 commit comments

Comments
 (0)