Skip to content

Commit

Permalink
update zsh test
Browse files Browse the repository at this point in the history
  • Loading branch information
polonez committed Mar 28, 2017
1 parent cd17377 commit 9a9abe1
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions tests/cli-self-upd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,34 +302,25 @@ fn uninstall_stress_test() {
}

#[cfg(unix)]
fn install_adds_path_to_rc(config: &Config, rcfile: &str) {
let my_rc = "foo\nbar\nbaz";
let ref rc = config.homedir.join(rcfile);
raw::write_file(rc, my_rc).unwrap();
expect_ok(config, &["rustup-init", "-y"]);

let new_rc = raw::read_file(rc).unwrap();
let addition = format!(r#"export PATH="{}/bin:$PATH""#,
config.cargodir.display());
let expected = format!("{}\n{}\n", my_rc, addition);
assert_eq!(new_rc, expected);
}

#[test]
#[cfg(unix)]
fn install_adds_path_to_profile() {
fn install_adds_path_to_rc(rcfile: &str) {
setup(&|config| {
install_adds_path_to_rc(config, ".profile");
let my_rc = "foo\nbar\nbaz";
let ref rc = config.homedir.join(rcfile);
raw::write_file(rc, my_rc).unwrap();
expect_ok(config, &["rustup-init", "-y"]);

let new_rc = raw::read_file(rc).unwrap();
let addition = format!(r#"export PATH="{}/bin:$PATH""#,
config.cargodir.display());
let expected = format!("{}\n{}\n", my_rc, addition);
assert_eq!(new_rc, expected);
});
}

#[test]
#[cfg(unix)]
fn install_adds_path_to_zprofile() {
setup(&|config| {
env::set_var("SHELL", "/bin/zsh");
install_adds_path_to_rc(config, ".zprofile");
});
fn install_adds_path_to_profile() {
install_adds_path_to_rc(".profile");
}

#[test]
Expand Down

0 comments on commit 9a9abe1

Please sign in to comment.