test(github): find gh on PATH in the blank-variable token test

The test placed gh only at /opt/homebrew/bin/gh, which gh_candidates never
offers on Windows, so the Windows CI job panicked at unwrap. Put gh on a PATH
directory spelled with the platform's exe name instead.
This commit is contained in:
l0ng-ai
2026-09-27 11:20:31 +02:00
parent 5d755b39f0
commit 8fa45858ac
+12 -1
View File
@@ -221,11 +221,22 @@ mod tests {
fn a_blank_variable_is_no_token_and_falls_through() {
let mut f = Fake::new();
f.vars.insert("GH_TOKEN", " ");
f.files.push(PathBuf::from("/opt/homebrew/bin/gh"));
// A `gh` on PATH, spelled the way this platform spells it: the
// Homebrew fallbacks don't exist on Windows, so the test must not
// lean on them.
let path = if cfg!(windows) {
r"C:\fake\bin"
} else {
"/fake/bin"
};
f.vars.insert("PATH", path);
let gh = gh_candidates(Some(path)).remove(0);
f.files.push(gh.clone());
f.gh_out = Some("gho_cli\n");
let (token, source) = f.resolve().unwrap();
assert_eq!(token.expose(), "gho_cli");
assert_eq!(source, TokenSource::GhCli);
assert_eq!(*f.asked.borrow(), vec![gh]);
}
#[cfg(unix)]