diff --git a/modules/integration/src/test/scala/scala/cli/integration/CoursierScalaInstallationTestHelper.scala b/modules/integration/src/test/scala/scala/cli/integration/CoursierScalaInstallationTestHelper.scala index 2eb53db2e8..3edc2944b2 100644 --- a/modules/integration/src/test/scala/scala/cli/integration/CoursierScalaInstallationTestHelper.scala +++ b/modules/integration/src/test/scala/scala/cli/integration/CoursierScalaInstallationTestHelper.scala @@ -80,15 +80,17 @@ trait CoursierScalaInstallationTestHelper { 0, underlyingScriptPath.toString().indexOf(scalaVersion) + scalaVersion.length )) - System.err.println(s"Cleaning up, trying to remove $csPrebuiltBinaryDir") - try { - os.remove.all(csPrebuiltBinaryDir) + if (!Properties.isWin) { + System.err.println(s"Cleaning up, trying to remove $csPrebuiltBinaryDir") + try { + os.remove.all(csPrebuiltBinaryDir) - System.err.println(s"Cleanup complete. Removed $csPrebuiltBinaryDir") - } - catch { - case ex: java.nio.file.FileSystemException => - System.err.println(s"Failed to remove $csPrebuiltBinaryDir: $ex") + System.err.println(s"Cleanup complete. Removed $csPrebuiltBinaryDir") + } + catch { + case ex: java.nio.file.FileSystemException => + System.err.println(s"Failed to remove $csPrebuiltBinaryDir: $ex") + } } } } diff --git a/modules/integration/src/test/scala/scala/cli/integration/RunTestDefinitions.scala b/modules/integration/src/test/scala/scala/cli/integration/RunTestDefinitions.scala index c3b7c2ee91..862b268a87 100644 --- a/modules/integration/src/test/scala/scala/cli/integration/RunTestDefinitions.scala +++ b/modules/integration/src/test/scala/scala/cli/integration/RunTestDefinitions.scala @@ -1069,6 +1069,19 @@ abstract class RunTestDefinitions } } + test("UTF-8 characters on the input path & current working directory path") { + val expectedMessage = "Hello" + val utf8DirPath = os.rel / "äöü" + val inputName = "Hello.sc" + val inputPath = utf8DirPath / inputName + TestInputs(inputPath -> s"""println("$expectedMessage")""") + .fromRoot { root => + val res = os.proc(TestUtil.cli, "run", inputName, extraOptions) + .call(cwd = root / utf8DirPath) + expect(res.out.trim() == expectedMessage) + } + } + test("return relevant error if multiple .scala main classes are present") { TestUtil.retryOnCi() { val (scalaFile1, scalaFile2, scriptName) = diff --git a/modules/integration/src/test/scala/scala/cli/integration/SipScalaTests.scala b/modules/integration/src/test/scala/scala/cli/integration/SipScalaTests.scala index 992d111a1f..dcdb15b1aa 100644 --- a/modules/integration/src/test/scala/scala/cli/integration/SipScalaTests.scala +++ b/modules/integration/src/test/scala/scala/cli/integration/SipScalaTests.scala @@ -883,4 +883,31 @@ class SipScalaTests extends ScalaCliSuite expect(launcherVersionOverrideHelp == standardVersionOverrideHelp) } } + + test("coursier scala installation works with utf8 paths") { + val utf8DirPath = os.rel / "äöü" + TestInputs(utf8DirPath / "version.sc" -> + "println(dotty.tools.dotc.config.Properties.versionNumberString)") + .fromRoot { root => + val rootWithUtf8 = root / utf8DirPath + val localCache = rootWithUtf8 / "local-cache" + val localBin = rootWithUtf8 / "local-bin" + val scalaVersion = Constants.scala3NextRcAnnounced + withScalaRunnerWrapper( + root = rootWithUtf8, + localCache = localCache, + localBin = localBin, + scalaVersion = scalaVersion + ) { launchScalaPath => + val r = os.proc(launchScalaPath, "--with-compiler", "version.sc") + .call( + cwd = rootWithUtf8, + env = Map("COURSIER_CACHE" -> localCache.toString), + check = false // need to clean up even on failure + ) + expect(r.exitCode == 0) + expect(r.out.trim() == scalaVersion) + } + } + } }