Skip to content

Commit

Permalink
add regression tests for smart guess
Browse files Browse the repository at this point in the history
  • Loading branch information
Xerxes-2 authored and rami3l committed Jun 26, 2024
1 parent af0867b commit f48df22
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/suite/cli_misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,3 +1180,27 @@ async fn toolchain_link_then_list_verbose() {
.expect_stdout_ok(&["rustup", "toolchain", "list", "-v"], "/custom-1")
.await;
}

#[tokio::test]
async fn update_self_smart_guess() {
let cx = CliTestContext::new(Scenario::SimpleV2).await;
let out = cx.config.run("rustup", &["update", "self"], &[]).await;
let invalid_toolchain = out.stderr.contains("invalid toolchain name");
if !out.ok && invalid_toolchain {
assert!(out
.stderr
.contains("if you meant to update rustup itself, use `rustup self update`"))
}
}

#[tokio::test]
async fn uninstall_self_smart_guess() {
let cx = CliTestContext::new(Scenario::SimpleV2).await;
let out = cx.config.run("rustup", &["uninstall", "self"], &[]).await;
let no_toolchain_installed = out.stdout.contains("no toolchain installed");
if out.ok && no_toolchain_installed {
assert!(out
.stdout
.contains("if you meant to uninstall rustup itself, use `rustup self uninstall`"))
}
}

0 comments on commit f48df22

Please sign in to comment.