Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Jan 9, 2019
1 parent b132485 commit eaab76e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
32 changes: 32 additions & 0 deletions tests/cli-self-upd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,38 @@ fn rustup_self_updates() {
})
}

#[test]
fn rustup_self_updates_with_specified_toolchain() {
update_setup(&|config, _| {
expect_ok(config, &["rustup-init", "-y"]);

let ref bin = config.cargodir.join(&format!("bin/rustup{}", EXE_SUFFIX));
let before_hash = calc_hash(bin);

expect_ok(config, &["rustup", "update", "stable"]);

let after_hash = calc_hash(bin);

assert_ne!(before_hash, after_hash);
})
}

#[test]
fn rustup_no_self_update_with_specified_toolchain() {
update_setup(&|config, _| {
expect_ok(config, &["rustup-init", "-y"]);

let ref bin = config.cargodir.join(&format!("bin/rustup{}", EXE_SUFFIX));
let before_hash = calc_hash(bin);

expect_ok(config, &["rustup", "update", "stable", "--no-self-update"]);

let after_hash = calc_hash(bin);

assert_eq!(before_hash, after_hash);
})
}

#[test]
fn rustup_self_update_exact() {
update_setup(&|config, _| {
Expand Down
5 changes: 4 additions & 1 deletion tests/cli-v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,9 @@ fn update_unavailable_force() {
trip
),
);
expect_ok(config, &["rustup", "update", "nightly", "--force", "--no-self-update"]);
expect_ok(
config,
&["rustup", "update", "nightly", "--force", "--no-self-update"],
);
});
}

0 comments on commit eaab76e

Please sign in to comment.