Skip to content

Commit c891ee5

Browse files
authored
Merge pull request #108 from scala/backport-lts-3.3-21937
Backport "Fix Windows OS detection in TraceNameManglingTest" to 3.3 LTS
2 parents ce6ab76 + 323515b commit c891ee5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ class TraceNameManglingTest extends DottyTest {
2727
}
2828

2929
@Test def escapeBackslashes(): Unit = {
30-
val isWindows = sys.props("os.name").toLowerCase(Locale.ROOT) == "windows"
31-
val filename = if isWindows then "/.scala" else "\\.scala"
30+
val isWindows = sys.props("os.name").toLowerCase(Locale.ROOT).nn.contains("windows")
31+
// It is not possible to create a file with backslash in name on Windows
32+
val filename = if isWindows then "test.scala" else "\\.scala"
3233
checkTraceEvents(
3334
"""
3435
|class /\ :
@@ -46,7 +47,8 @@ class TraceNameManglingTest extends DottyTest {
4647
raw"setter /\\_="
4748
).map(TraceEvent("typecheck", _))
4849
++ Set(
49-
TraceEvent("file", if isWindows then "/.scala" else "\\\\.scala")
50+
// See comment aboce for Windows limitations
51+
TraceEvent("file", if isWindows then filename else "\\\\.scala")
5052
)
5153
)
5254
}

0 commit comments

Comments
 (0)