From 8fa45858ac968fc41e97b149df41de0919fa51af Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sun, 27 Sep 2026 11:20:31 +0200 Subject: [PATCH] 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. --- crates/tty7-core/src/core/github/token.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/tty7-core/src/core/github/token.rs b/crates/tty7-core/src/core/github/token.rs index 174a5635..a51e5f4a 100644 --- a/crates/tty7-core/src/core/github/token.rs +++ b/crates/tty7-core/src/core/github/token.rs @@ -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)]