Fix compiletest windows path finding with spaces

This commit is contained in:
Alex Macleod 2023-07-14 21:28:19 +00:00
parent 079e544174
commit 1ce61836dc
2 changed files with 6 additions and 6 deletions

View File

@ -4149,8 +4149,8 @@ fn normalize_platform_differences(output: &str) -> String {
# Match paths that don't include spaces.
(?:\\[\pL\pN\.\-_']+)+\.\pL+
|
# If the path starts with a well-known root, then allow spaces.
\$(?:DIR|SRC_DIR|TEST_BUILD_DIR|BUILD_DIR|LIB_DIR)(?:\\[\pL\pN\.\-_' ]+)+
# If the path starts with a well-known root, then allow spaces and no file extension.
\$(?:DIR|SRC_DIR|TEST_BUILD_DIR|BUILD_DIR|LIB_DIR)(?:\\[\pL\pN\.\-_'\ ]+)+
)"#,
)
.unwrap()

View File

@ -8,8 +8,8 @@ fn normalize_platform_differences() {
"$BUILD_DIR/../parser.rs"
);
assert_eq!(
TestCx::normalize_platform_differences(r"$DIR\bar.rs hello\nworld"),
r"$DIR/bar.rs hello\nworld"
TestCx::normalize_platform_differences(r"$DIR\bar.rs: hello\nworld"),
r"$DIR/bar.rs: hello\nworld"
);
assert_eq!(
TestCx::normalize_platform_differences(r"either bar\baz.rs or bar\baz\mod.rs"),
@ -27,8 +27,8 @@ fn normalize_platform_differences() {
);
assert_eq!(TestCx::normalize_platform_differences(r"$DIR\foo.rs:12:11"), "$DIR/foo.rs:12:11",);
assert_eq!(
TestCx::normalize_platform_differences(r"$DIR\path with spaces 'n' quotes"),
"$DIR/path with spaces 'n' quotes",
TestCx::normalize_platform_differences(r"$DIR\path with\spaces 'n' quotes"),
"$DIR/path with/spaces 'n' quotes",
);
assert_eq!(
TestCx::normalize_platform_differences(r"$DIR\file_with\no_extension"),