Skip to content

Commit 8095f81

Browse files
committed
Created run_input_with_env.
1 parent 76164d2 commit 8095f81

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

tests/cli-inst-interactive.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,22 @@ pub fn setup(f: &dyn Fn(&Config)) {
4141
}
4242

4343
fn run_input(config: &Config, args: &[&str], input: &str) -> SanitizedOutput {
44+
run_input_with_env(config, args, input, &[])
45+
}
46+
47+
fn run_input_with_env(
48+
config: &Config,
49+
args: &[&str],
50+
input: &str,
51+
env: &[(&str, &str)],
52+
) -> SanitizedOutput {
4453
let mut cmd = clitools::cmd(config, args[0], &args[1..]);
4554
clitools::env(config, &mut cmd);
4655

56+
for (key, value) in env.iter() {
57+
cmd.env(key, value);
58+
}
59+
4760
cmd.stdin(Stdio::piped());
4861
cmd.stdout(Stdio::piped());
4962
cmd.stderr(Stdio::piped());
@@ -345,7 +358,3 @@ fn test_warn_succeed_if_rustup_sh_already_installed_y_flag() {
345358
assert!(!out.stdout.contains("Continue? (y/N)"));
346359
})
347360
}
348-
349-
#[ignore] // Can't test environment variable.
350-
#[test]
351-
fn test_succeed_if_rustup_sh_already_installed_env_var_set() {}

0 commit comments

Comments
 (0)