Skip to content

Commit

Permalink
Fix BashExitCodeTests file paths for windows (#15654)
Browse files Browse the repository at this point in the history
* fix-bash-script-exit-code test-paths
  • Loading branch information
rochala authored Jul 12, 2022
1 parent 7e6b3c2 commit 8fc154e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions compiler/test/dotty/tools/scripting/BashExitCodeTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object BashExitCodeTests:
)(using temporaryDir: File): Unit =
assertTestExists(testName) { testFile =>
val testFilePath = testFile.absPath
val commandline = (Seq(scalacPath, "-d", temporaryDir, testFilePath)).mkString(" ")
val commandline = (Seq(scalacPath, "-d", temporaryDir.absPath, testFilePath)).mkString(" ")
val (validTest, exitCode, _, _) = bashCommand(commandline)
if verifyValid(validTest) then
assertEquals(expectedExitCode, exitCode)
Expand All @@ -46,8 +46,8 @@ object BashExitCodeTests:
)(using temporaryDir: File): Unit =
val testClassFile = temporaryDir.files.find(_.getName == s"$className.class")
assert(testClassFile.isDefined)
val commandline = (Seq(scalaPath, "-classpath", temporaryDir.getAbsolutePath, className)).mkString(" ")
val (validTest, exitCode, o, e) = bashCommand(commandline)
val commandline = (Seq(scalaPath, "-classpath", temporaryDir.absPath, className)).mkString(" ")
val (validTest, exitCode, _, _) = bashCommand(commandline)
if verifyValid(validTest) then
assertEquals(expectedExitCode, exitCode)

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

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

@Category(Array(classOf[BootstrappedOnlyTests]))
class BashExitCodeTests:
Expand Down

0 comments on commit 8fc154e

Please sign in to comment.