Skip to content

Commit

Permalink
Update test conditions to check cache path for each system
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejG604 committed Nov 29, 2023
1 parent c4447b3 commit f9590f9
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2101,6 +2101,7 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
val input = "script.sc"
TestInputs(os.rel / input -> s"println(\"$msg\")")
.fromRoot { root =>
expect(!os.isDir(root / getCoursierCacheRelPath))
val res = os.proc(customCall, "run", extraOptions, "--server=false", input)
.call(
cwd = root,
Expand All @@ -2112,7 +2113,8 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
"user.home property is not valid: ?, setting it to user.dir value"
)
)
expect(os.isDir(root / getCoursierCacheRelPath))
if (!Properties.isWin) // coursier cache location on Windows does not depend on home dir
expect(os.isDir(root / getCoursierCacheRelPath))
}
}

Expand All @@ -2124,10 +2126,10 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
.fromRoot { root =>
val newHomePath = root / "home"
os.makeDir(newHomePath)
expect(!os.isDir(newHomePath / "Library" / "Caches" / "Coursier"))
expect(!os.isDir(newHomePath / getCoursierCacheRelPath))
val extraEnv = Map("SCALA_CLI_HOME_DIR_OVERRIDE" -> newHomePath.toString())

val res = os.proc(TestUtil.cli, "run", extraOptions, "--server=false", input)
val res = os.proc(TestUtil.cli, "run", extraOptions, "--server=false", input, "--command")
.call(
cwd = root,
stderr = os.Pipe,
Expand All @@ -2139,7 +2141,8 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
"user.home property overridden with the SCALA_CLI_HOME_DIR_OVERRIDE"
)
)
expect(os.isDir(newHomePath / getCoursierCacheRelPath))
if (!Properties.isWin) // coursier cache location on Windows does not depend on home dir
expect(os.isDir(newHomePath / getCoursierCacheRelPath))
}
}
}

0 comments on commit f9590f9

Please sign in to comment.