Scripts: the backslash path test expects no lookups on Windows only

Outside Windows, `\\host\s\x.txt`, `\\?\C:\x.txt` and `\\.\pipe\x` are
relative file names in the script's folder, so `exists`, `open` and
`getFiles` look them up. The test now expects no lookups for them on
Windows only, and on macOS and Linux checks `//host/s/x.txt`, an absolute
path outside the folder, alone. The returned values are the same on every
platform.
This commit is contained in:
dotCooCoo
2026-11-11 09:46:57 -08:00
parent ba05554c64
commit 8269e140ce
+10 -1
View File
@@ -115,7 +115,16 @@ fn script_file_unc_rejected_before_lookup() {
vc.log(out);",
);
assert_eq!(log, json!([[false, false, null, false, false, null, false, false, null, false, false, null]]));
assert_eq!(script_probes(), before, "no network or device path was looked up");
if cfg!(windows) {
assert_eq!(script_probes(), before, "no network or device path was looked up");
} else {
// Outside Windows the backslash forms are relative file names in the script's folder, and
// `//host/s/x.txt` is an absolute path outside it.
let before = script_probes();
let log = logged(&base, "var f = new File('//host/s/x.txt'); vc.log([f.exists, f.open('r'), new Folder('//host/s/x.txt').getFiles()]);");
assert_eq!(log, json!([[false, false, null]]));
assert_eq!(script_probes(), before, "a path outside the script's folder was not looked up");
}
let _ = std::fs::remove_dir_all(base);
}