Skip to content

Commit f0580df

Browse files
committed
Auto merge of #113706 - Alexendoo:compiletest-backslash-re, r=oli-obk
Fix compiletest windows path finding with spaces With `(?x)` enabled spaces are ignored unless you escape them, so the space wasn't being added to the character class I don't think this makes any difference to the current test suite, but it could save someone a headache in the future
2 parents c44324a + 1ce6183 commit f0580df

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/tools/compiletest/src/runtest.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4149,8 +4149,8 @@ impl<'test> TestCx<'test> {
41494149
# Match paths that don't include spaces.
41504150
(?:\\[\pL\pN\.\-_']+)+\.\pL+
41514151
|
4152-
# If the path starts with a well-known root, then allow spaces.
4153-
\$(?:DIR|SRC_DIR|TEST_BUILD_DIR|BUILD_DIR|LIB_DIR)(?:\\[\pL\pN\.\-_' ]+)+
4152+
# If the path starts with a well-known root, then allow spaces and no file extension.
4153+
\$(?:DIR|SRC_DIR|TEST_BUILD_DIR|BUILD_DIR|LIB_DIR)(?:\\[\pL\pN\.\-_'\ ]+)+
41544154
)"#,
41554155
)
41564156
.unwrap()

src/tools/compiletest/src/runtest/tests.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ fn normalize_platform_differences() {
88
"$BUILD_DIR/../parser.rs"
99
);
1010
assert_eq!(
11-
TestCx::normalize_platform_differences(r"$DIR\bar.rs hello\nworld"),
12-
r"$DIR/bar.rs hello\nworld"
11+
TestCx::normalize_platform_differences(r"$DIR\bar.rs: hello\nworld"),
12+
r"$DIR/bar.rs: hello\nworld"
1313
);
1414
assert_eq!(
1515
TestCx::normalize_platform_differences(r"either bar\baz.rs or bar\baz\mod.rs"),
@@ -27,8 +27,8 @@ fn normalize_platform_differences() {
2727
);
2828
assert_eq!(TestCx::normalize_platform_differences(r"$DIR\foo.rs:12:11"), "$DIR/foo.rs:12:11",);
2929
assert_eq!(
30-
TestCx::normalize_platform_differences(r"$DIR\path with spaces 'n' quotes"),
31-
"$DIR/path with spaces 'n' quotes",
30+
TestCx::normalize_platform_differences(r"$DIR\path with\spaces 'n' quotes"),
31+
"$DIR/path with/spaces 'n' quotes",
3232
);
3333
assert_eq!(
3434
TestCx::normalize_platform_differences(r"$DIR\file_with\no_extension"),

0 commit comments

Comments
 (0)