From 8269e140ceed2463bbc9c4c17553e0a763396c12 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 11 Nov 2026 09:46:57 -0800 Subject: [PATCH] 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. --- crates/engine/src/tests/script_io.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/tests/script_io.rs b/crates/engine/src/tests/script_io.rs index 2dc1253c1b..aae4810dad 100644 --- a/crates/engine/src/tests/script_io.rs +++ b/crates/engine/src/tests/script_io.rs @@ -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); }