Skip to content

Commit

Permalink
Added test for RUSTUP_INIT_SKIP_CHECKING_EXISTENCE.
Browse files Browse the repository at this point in the history
  • Loading branch information
sollyucko committed Feb 2, 2020
1 parent c19454b commit 454c028
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/cli-inst-interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,35 @@ fn test_warn_succeed_if_rustup_sh_already_installed_y_flag() {
assert!(!out.stdout.contains("Continue? (y/N)"));
})
}

#[test]
fn test_succeed_if_rustup_sh_already_installed_env_var_set() {
setup(&|config| {
create_rustup_sh_metadata(&config);
let mut cmd = clitools::cmd(config, "rustup-init", &["-y"]);
clitools::env(config, &mut cmd);
cmd.env("RUSTUP_INIT_SKIP_EXISTENCE_CHECKS", "yes");

cmd.stdin(Stdio::piped());
cmd.stdout(Stdio::piped());
cmd.stderr(Stdio::piped());
let _out = cmd.spawn().unwrap().wait_with_output().unwrap();
let out = SanitizedOutput {
ok: _out.status.success(),
stdout: String::from_utf8(_out.stdout).unwrap(),
stderr: String::from_utf8(_out.stderr).unwrap(),
};

assert!(out.ok);
assert!(!out
.stderr
.contains("warning: it looks like you have existing rustup.sh metadata"));
assert!(!out
.stderr
.contains("error: cannot install while rustup.sh is installed"));
assert!(!out.stderr.contains(
"warning: continuing (because the -y flag is set and the error is ignorable)"
));
assert!(!out.stdout.contains("Continue? (y/N)"));
})
}

0 comments on commit 454c028

Please sign in to comment.