Skip to content

Commit f48df22

Browse files
Xerxes-2rami3l
authored andcommitted
add regression tests for smart guess
1 parent af0867b commit f48df22

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/suite/cli_misc.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,3 +1180,27 @@ async fn toolchain_link_then_list_verbose() {
11801180
.expect_stdout_ok(&["rustup", "toolchain", "list", "-v"], "/custom-1")
11811181
.await;
11821182
}
1183+
1184+
#[tokio::test]
1185+
async fn update_self_smart_guess() {
1186+
let cx = CliTestContext::new(Scenario::SimpleV2).await;
1187+
let out = cx.config.run("rustup", &["update", "self"], &[]).await;
1188+
let invalid_toolchain = out.stderr.contains("invalid toolchain name");
1189+
if !out.ok && invalid_toolchain {
1190+
assert!(out
1191+
.stderr
1192+
.contains("if you meant to update rustup itself, use `rustup self update`"))
1193+
}
1194+
}
1195+
1196+
#[tokio::test]
1197+
async fn uninstall_self_smart_guess() {
1198+
let cx = CliTestContext::new(Scenario::SimpleV2).await;
1199+
let out = cx.config.run("rustup", &["uninstall", "self"], &[]).await;
1200+
let no_toolchain_installed = out.stdout.contains("no toolchain installed");
1201+
if out.ok && no_toolchain_installed {
1202+
assert!(out
1203+
.stdout
1204+
.contains("if you meant to uninstall rustup itself, use `rustup self uninstall`"))
1205+
}
1206+
}

0 commit comments

Comments
 (0)