Skip to content

Commit 078d1cb

Browse files
committed
embed relative paths to scalac and scala in BashScriptsTests.scala
1 parent e38932c commit 078d1cb

File tree

1 file changed

+34
-35
lines changed

1 file changed

+34
-35
lines changed

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

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -36,47 +36,46 @@ class BashScriptsTests:
3636

3737
val showArgsScript = testFiles.find(_.getName == "showArgs.sc").get.absPath
3838

39-
val scalacPath = which("scalac")
40-
val scalaPath = which("scala")
39+
val scalacPath = "dist/target/pack/bin/scalac" // which("scalac")
40+
val scalaPath = "dist/target/pack/bin/scala" // which("scala")
4141

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

6261
/* verify `dist/bin/scala` */
6362
@Test def verifyScalaArgs =
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)
63+
val commandline = (Seq(scalaPath, showArgsScript) ++ testScriptArgs).mkString(" ")
64+
if bashPath.toFile.exists then
65+
var cmd = Array(bashExe, "-c", commandline)
66+
val output = for {
67+
line <- Process(cmd).lazyLines_!
68+
} yield line
69+
var fail = false
70+
printf("\n")
71+
var mismatches = List.empty[(String,String)]
72+
for (line, expect) <- output zip expectedOutput do
73+
printf("expected: %-17s\nactual : %s\n", expect, line)
74+
if line != expect then
75+
fail = true
76+
77+
if fail then
78+
assert(output == expectedOutput)
8079

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

0 commit comments

Comments
 (0)