Skip to content

Commit

Permalink
Fix Windows OS detection in TraceNameManglingTest (#21937)
Browse files Browse the repository at this point in the history
Fixes #21936 

[test_windows_full]
  • Loading branch information
WojciechMazur authored Nov 13, 2024
1 parent 7243053 commit dbd4988
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ class TraceNameManglingTest extends DottyTest {
}

@Test def escapeBackslashes(): Unit = {
val isWindows = sys.props("os.name").toLowerCase(Locale.ROOT) == "windows"
val filename = if isWindows then "/.scala" else "\\.scala"
val isWindows = sys.props("os.name").toLowerCase(Locale.ROOT).nn.contains("windows")
// It is not possible to create a file with backslash in name on Windows
val filename = if isWindows then "test.scala" else "\\.scala"
checkTraceEvents(
"""
|class /\ :
Expand All @@ -46,7 +47,8 @@ class TraceNameManglingTest extends DottyTest {
raw"setter /\\_="
).map(TraceEvent("typecheck", _))
++ Set(
TraceEvent("file", if isWindows then "/.scala" else "\\\\.scala")
// See comment aboce for Windows limitations
TraceEvent("file", if isWindows then filename else "\\\\.scala")
)
)
}
Expand Down

0 comments on commit dbd4988

Please sign in to comment.