Skip to content

Commit c72a9b2

Browse files
committed
Unset GIT_ASKPASS in tests that assume it is unset
Two of the askpass tests assume `GIT_ASKPASS` is not set. Before this change, they wrongly fail when it is set, even if the code under test is working correctly. 1. ssh_askpass_is_used_as_fallback 2. ssh_askpass_does_not_override_current_value As other tests that deliberately involve `GIT_ASKPASS` (and therefore do not need to be modified) attest, when it is set: 1. `SSH_ASKPASS` is not used as a fallback (`GIT_ASKPASS` deliberately takes precedence). 2. Although `SSH_ASKPASS` still does not override the current value, `GIT_ASKPASS` does override it, so checking for equality to the current value fails. Since those test cases are among those that already have the `serial` attribute and already temporarily modify the environment, this extends that modification by having it also temporarily unset `GIT_ASKPASS` if it was set.
1 parent 8ce1ebf commit c72a9b2

File tree

1 file changed

+2
-2
lines changed
  • gix-prompt/tests/options

1 file changed

+2
-2
lines changed

gix-prompt/tests/options/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mod apply_environment {
4545
#[test]
4646
#[serial]
4747
fn ssh_askpass_is_used_as_fallback() {
48-
let _env = Env::new().set("SSH_ASKPASS", "fallback");
48+
let _env = Env::new().unset("GIT_ASKPASS").set("SSH_ASKPASS", "fallback");
4949

5050
assert_eq!(
5151
Options {
@@ -63,7 +63,7 @@ mod apply_environment {
6363
#[test]
6464
#[serial]
6565
fn ssh_askpass_does_not_override_current_value() {
66-
let _env = Env::new().set("SSH_ASKPASS", "fallback");
66+
let _env = Env::new().unset("GIT_ASKPASS").set("SSH_ASKPASS", "fallback");
6767

6868
assert_eq!(
6969
Options {

0 commit comments

Comments
 (0)