Skip to content

Commit dbd4988

Browse files
Fix Windows OS detection in TraceNameManglingTest (#21937)
Fixes #21936 [test_windows_full]
1 parent 7243053 commit dbd4988

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)