Skip to content

Commit 193ed35

Browse files
committed
Try to fix tests for windows
1 parent cff3cde commit 193ed35

File tree

1 file changed

+8
-7
lines changed
  • crates/zuban_python/tests/mypylike

1 file changed

+8
-7
lines changed

crates/zuban_python/tests/mypylike/main.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -445,14 +445,15 @@ impl TestCase<'_, '_> {
445445
s = s.replace("__main__.py:", "__main__:");
446446
}
447447
if cfg!(target_os = "windows") {
448-
// TODO this only checks the first line, but with notes there may
449-
// be multiple lines.
450-
let colon = s.find(":").unwrap();
451-
let to_change = &mut s[..colon];
452448
// Safety: OK because we only modify ASCII
453-
for b in unsafe { to_change.as_bytes_mut() } {
454-
if *b == b'\\' {
455-
*b = b'/'
449+
let bytes = unsafe { s.as_bytes_mut() };
450+
for line in bytes.split_mut(|c| *c == b'\n') {
451+
let colon = line.iter().position(|c| *c == b':').unwrap();
452+
let to_change = &mut line[..colon];
453+
for b in to_change {
454+
if *b == b'\\' {
455+
*b = b'/'
456+
}
456457
}
457458
}
458459
}

0 commit comments

Comments
 (0)