Skip to content

Commit

Permalink
Created run_input_with_env.
Browse files Browse the repository at this point in the history
  • Loading branch information
sollyucko committed Feb 2, 2020
1 parent 014e78c commit c19454b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/cli-inst-interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,22 @@ pub fn setup(f: &dyn Fn(&Config)) {
}

fn run_input(config: &Config, args: &[&str], input: &str) -> SanitizedOutput {
run_input_with_env(config, args, input, &[])
}

fn run_input_with_env(
config: &Config,
args: &[&str],
input: &str,
env: &[(&str, &str)],
) -> SanitizedOutput {
let mut cmd = clitools::cmd(config, args[0], &args[1..]);
clitools::env(config, &mut cmd);

for (key, value) in env.iter() {
cmd.env(key, value);
}

cmd.stdin(Stdio::piped());
cmd.stdout(Stdio::piped());
cmd.stderr(Stdio::piped());
Expand Down Expand Up @@ -345,7 +358,3 @@ fn test_warn_succeed_if_rustup_sh_already_installed_y_flag() {
assert!(!out.stdout.contains("Continue? (y/N)"));
})
}

#[ignore] // Can't test environment variable.
#[test]
fn test_succeed_if_rustup_sh_already_installed_env_var_set() {}

0 comments on commit c19454b

Please sign in to comment.