Skip to content

Commit eaab76e

Browse files
committed
Add tests
1 parent b132485 commit eaab76e

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

tests/cli-self-upd.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,38 @@ fn rustup_self_updates() {
715715
})
716716
}
717717

718+
#[test]
719+
fn rustup_self_updates_with_specified_toolchain() {
720+
update_setup(&|config, _| {
721+
expect_ok(config, &["rustup-init", "-y"]);
722+
723+
let ref bin = config.cargodir.join(&format!("bin/rustup{}", EXE_SUFFIX));
724+
let before_hash = calc_hash(bin);
725+
726+
expect_ok(config, &["rustup", "update", "stable"]);
727+
728+
let after_hash = calc_hash(bin);
729+
730+
assert_ne!(before_hash, after_hash);
731+
})
732+
}
733+
734+
#[test]
735+
fn rustup_no_self_update_with_specified_toolchain() {
736+
update_setup(&|config, _| {
737+
expect_ok(config, &["rustup-init", "-y"]);
738+
739+
let ref bin = config.cargodir.join(&format!("bin/rustup{}", EXE_SUFFIX));
740+
let before_hash = calc_hash(bin);
741+
742+
expect_ok(config, &["rustup", "update", "stable", "--no-self-update"]);
743+
744+
let after_hash = calc_hash(bin);
745+
746+
assert_eq!(before_hash, after_hash);
747+
})
748+
}
749+
718750
#[test]
719751
fn rustup_self_update_exact() {
720752
update_setup(&|config, _| {

tests/cli-v2.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,9 @@ fn update_unavailable_force() {
873873
trip
874874
),
875875
);
876-
expect_ok(config, &["rustup", "update", "nightly", "--force", "--no-self-update"]);
876+
expect_ok(
877+
config,
878+
&["rustup", "update", "nightly", "--force", "--no-self-update"],
879+
);
877880
});
878881
}

0 commit comments

Comments
 (0)