From 4463678fca5c788ec33608f70735269f19246298 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 13 Nov 2024 23:41:05 +0100 Subject: [PATCH] Fix Windows OS detection in TraceNameManglingTest (#21937) Fixes #21936 [test_windows_full] --- .../dotty/tools/dotc/profile/TraceNameManglingTest.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala b/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala index 977b67740f88..f1f570cc85d4 100644 --- a/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala +++ b/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala @@ -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 /\ : @@ -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") ) ) }