Skip to content

Commit 2e13428

Browse files
authored
Merge pull request #30364 from compnerd/windows-filenames
test: adjust the test to improve the viability on Windows
2 parents d0af9ee + 6c02e62 commit 2e13428

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/SILGen/magic_identifier_file_conflicting.swift.gyb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %gyb -D TEMPDIR=%t %s -o %t/magic_identifier_file_conflicting.swift
2+
// RUN: %gyb -D TEMPDIR=%t %s > %t/magic_identifier_file_conflicting.swift
3+
// RUN: %{python} -c "import sys; t = open(sys.argv[1], 'rb').read().replace('\r\n', '\n'); open(sys.argv[1], 'wb').write(t)" %t/magic_identifier_file_conflicting.swift
34

45
// We want to check both the diagnostics and the SIL output.
56
// RUN: %target-swift-emit-silgen -verify -emit-sorted-sil -enable-experimental-concise-pound-file -module-name Foo %t/magic_identifier_file_conflicting.swift %S/Inputs/magic_identifier_file_conflicting_other.swift | %FileCheck %s
@@ -11,12 +12,14 @@
1112

1213
%{
1314
TEMPDIR_ESC = TEMPDIR.replace('\\', '\\\\')
15+
16+
import os
1417
def fixit_loc(start_col, orig_suffix):
1518
"""
1619
Computes a "start-end" string for a fix-it replacing a string literal which
1720
starts at start_col and joins orig_suffix to TEMPDIR with a slash.
1821
"""
19-
original = '"{0}/{1}"'.format(TEMPDIR, orig_suffix)
22+
original = '"{0}"'.format(os.path.join(TEMPDIR, orig_suffix))
2023
end_col = start_col + len(original)
2124
return '{0}-{1}'.format(start_col, end_col)
2225
}%

0 commit comments

Comments
 (0)