Skip to content

Commit 7186eed

Browse files
committed
Refactor the test for readability
1 parent a2dc5d8 commit 7186eed

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/tools/src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -885,13 +885,16 @@ mod tests {
885885
assert_eq!(git_version_from_bytes(b"git version 2.37.2\n").unwrap(), (2, 37, 2));
886886
}
887887

888-
fn check_configure_clears_scope(scope_env_var: &str, scope_option: &str) {
889-
let temp = tempfile::TempDir::new().expect("can create temp dir");
888+
fn check_configure_clears_scope(scope_env_key: &str, scope_option: &str) {
889+
let scope_env_value = "gitconfig";
890890

891891
#[cfg(windows)]
892-
let names = ["config", "-"];
892+
let names = [scope_env_value, "-"];
893893
#[cfg(not(windows))]
894-
let names = ["config", "-", ":"];
894+
let names = [scope_env_value, "-", ":"];
895+
896+
let temp = tempfile::TempDir::new().expect("can create temp dir");
897+
895898
for name in names {
896899
File::create_new(temp.path().join(name))
897900
.expect("can create file")
@@ -900,7 +903,7 @@ mod tests {
900903
}
901904

902905
let mut cmd = std::process::Command::new("git");
903-
cmd.env(scope_env_var, "config"); // configure_command() should override it.
906+
cmd.env(scope_env_key, scope_env_value); // configure_command() should override it.
904907
let args = ["config", "-l", "--show-origin", scope_option].map(String::from);
905908
configure_command(&mut cmd, &args, temp.path());
906909

0 commit comments

Comments
 (0)