Skip to content

Commit

Permalink
test: add check-only and enable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 committed May 12, 2021
1 parent 2cf2283 commit f46b487
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
82 changes: 82 additions & 0 deletions tests/cli-exact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,88 @@ info: default toolchain set to 'nightly-{0}'
});
}

#[test]
fn update_once_and_check_self_update() {
let test_version = "2.0.0";

self_update_setup(
&|config, _| {
expect_ok(config, &["rustup-init", "-y", "--no-modify-path"]);
expect_ok(config, &["rustup", "set", "auto-self-update", "check-only"]);
let current_version = env!("CARGO_PKG_VERSION");

expect_ok_ex(
config,
&["rustup", "update", "nightly"],
&format!(
r"
nightly-{} installed - 1.3.0 (hash-nightly-2)
rustup - Update available : {} -> {}
",
&this_host_triple(),
current_version,
test_version
),
for_host!(
r"info: syncing channel updates for 'nightly-{0}'
info: latest update on 2015-01-02, rust version 1.3.0 (hash-nightly-2)
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: installing component 'cargo'
info: using up to 500.0 MiB of RAM to unpack components
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
"
),
);
},
test_version,
)
}

#[test]
fn update_once_and_self_update() {
let test_version = "2.0.0";

self_update_setup(
&|config, _| {
expect_ok(config, &["rustup-init", "-y", "--no-modify-path"]);
expect_ok(config, &["rustup", "set", "auto-self-update", "enable"]);
expect_ok_ex(
config,
&["rustup", "update", "nightly"],
for_host!(
r"
nightly-{0} installed - 1.3.0 (hash-nightly-2)
"
),
for_host!(
r"info: syncing channel updates for 'nightly-{0}'
info: latest update on 2015-01-02, rust version 1.3.0 (hash-nightly-2)
info: downloading component 'cargo'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: installing component 'cargo'
info: using up to 500.0 MiB of RAM to unpack components
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: checking for self-updates
info: downloading self-update
"
),
);
},
test_version,
)
}

#[test]
fn update_again() {
setup(&|config| {
Expand Down
1 change: 1 addition & 0 deletions tests/cli-v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,7 @@ fn install_with_component_and_target() {
#[test]
fn test_warn_if_complete_profile_is_used() {
setup(&|config| {
expect_ok(config, &["rustup", "set", "auto-self-update", "enable"]);
expect_err(
config,
&[
Expand Down

0 comments on commit f46b487

Please sign in to comment.