Skip to content

Commit f4bb773

Browse files
committed
Test that relative EXEPATH doesn't trigger the optimization
This tests that a nonempty value of `EXEPATH` that is a realtive path does not trigger the `EXEPATH` optimization of `system_prefix()` on Windows. This is similar to the previously introduced test for an empty value, in that both are treated as relative paths. Like that test, this one currently fails, but both will pass once the `EXEPATH` optimization is refined to refuse to look under a non-absolute path.
1 parent 84f9672 commit f4bb773

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

gix-path/src/env/tests.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,21 @@ mod system_prefix {
121121
assert_eq!(outcome, None);
122122
}
123123
}
124+
125+
#[test]
126+
#[serial]
127+
fn exepath_nonempty_relative() {
128+
for name in ["mingw32", "mingw64", "clangarm64"] {
129+
let grandparent = tempfile::tempdir().expect("can create new temporary directory");
130+
let parent = grandparent
131+
.path()
132+
.canonicalize()
133+
.expect("path to the new directory works")
134+
.join("dir");
135+
std::fs::create_dir_all(parent.join(name)).expect("can create directories");
136+
let _cwd = gix_testtools::set_current_dir(grandparent.path()).expect("can change to test dir");
137+
let outcome = system_prefix_from_exepath_var(|key| if_exepath(key, "dir"));
138+
assert_eq!(outcome, None);
139+
}
140+
}
124141
}

0 commit comments

Comments
 (0)