Skip to content

Commit 8fc154e

Browse files
authored
Fix BashExitCodeTests file paths for windows (#15654)
* fix-bash-script-exit-code test-paths
1 parent 7e6b3c2 commit 8fc154e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object BashExitCodeTests:
2828
)(using temporaryDir: File): Unit =
2929
assertTestExists(testName) { testFile =>
3030
val testFilePath = testFile.absPath
31-
val commandline = (Seq(scalacPath, "-d", temporaryDir, testFilePath)).mkString(" ")
31+
val commandline = (Seq(scalacPath, "-d", temporaryDir.absPath, testFilePath)).mkString(" ")
3232
val (validTest, exitCode, _, _) = bashCommand(commandline)
3333
if verifyValid(validTest) then
3434
assertEquals(expectedExitCode, exitCode)
@@ -46,8 +46,8 @@ object BashExitCodeTests:
4646
)(using temporaryDir: File): Unit =
4747
val testClassFile = temporaryDir.files.find(_.getName == s"$className.class")
4848
assert(testClassFile.isDefined)
49-
val commandline = (Seq(scalaPath, "-classpath", temporaryDir.getAbsolutePath, className)).mkString(" ")
50-
val (validTest, exitCode, o, e) = bashCommand(commandline)
49+
val commandline = (Seq(scalaPath, "-classpath", temporaryDir.absPath, className)).mkString(" ")
50+
val (validTest, exitCode, _, _) = bashCommand(commandline)
5151
if verifyValid(validTest) then
5252
assertEquals(expectedExitCode, exitCode)
5353

@@ -74,7 +74,7 @@ object BashExitCodeTests:
7474
*/
7575
private def testCommandExitCode(args: Seq[String], expectedExitCode: Int): Unit =
7676
val commandline = args.mkString(" ")
77-
val (validTest, exitCode, output, erroutput) = bashCommand(commandline)
77+
val (validTest, exitCode, _, _) = bashCommand(commandline)
7878
if verifyValid(validTest) then
7979
assertEquals(expectedExitCode, exitCode)
8080

@@ -118,7 +118,9 @@ object BashExitCodeTests:
118118
* Returns path to the generated tasty file for given directory and classname
119119
*/
120120
private def getGeneratedTastyPath(className: String)(using temporaryDir: File): String =
121-
temporaryDir.toPath.resolve(s"$className.tasty").toString
121+
val file = temporaryDir.files.find(_.getName == s"$className.tasty")
122+
assert(file.isDefined)
123+
file.get.absPath
122124

123125
@Category(Array(classOf[BootstrappedOnlyTests]))
124126
class BashExitCodeTests:

0 commit comments

Comments
 (0)