Skip to content

Commit a87233c

Browse files
committed
Use a regex?
1 parent 14de4da commit a87233c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/uv/tests/common/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl TestContext {
123123
fn path_patterns(path: impl AsRef<Path>) -> Vec<String> {
124124
vec![
125125
format!(
126-
// Remove the trailing `\` or `/` from directories for cross-platform filters
126+
// Trim the trailing separator for cross-platform directories filters
127127
r"{}\\?/?",
128128
regex::escape(
129129
&path
@@ -135,11 +135,15 @@ impl TestContext {
135135
.display()
136136
.to_string(),
137137
)
138+
// Make seprators platform agnostic because on Windows we will display
139+
// paths with Unix-style separators sometimes
140+
.replace(r"\\", r"(\\|\/)")
138141
),
139142
// Include a non-canonicalized version
140143
format!(
141144
r"{}\\?/?",
142145
regex::escape(&path.as_ref().normalized().display().to_string())
146+
.replace(r"\\", r"(\\|\/)")
143147
),
144148
]
145149
}

0 commit comments

Comments
 (0)