Skip to content

Commit 339765b

Browse files
Evan Weilerkinnison
authored andcommitted
Add test for running an unavailable component
1 parent 5325497 commit 339765b

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

tests/cli-misc.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,30 @@ fn rls_exists_in_toolchain() {
445445
}
446446

447447
#[test]
448-
fn rls_does_not_exist_in_toolchain() {
448+
fn run_rls_when_not_available_in_toolchain() {
449+
clitools::setup(Scenario::UnavailableRls, &|config| {
450+
set_current_dist_date(config, "2015-01-01");
451+
expect_ok(config, &["rustup", "default", "nightly"]);
452+
expect_err(
453+
config,
454+
&["rls", "--version"],
455+
&format!(
456+
"the 'rls' component which provides the command 'rls{}' is not available for the 'nightly-{}' toolchain",
457+
EXE_SUFFIX,
458+
this_host_triple(),
459+
),
460+
);
461+
462+
set_current_dist_date(config, "2015-01-02");
463+
expect_ok(config, &["rustup", "update", "--no-self-update"]);
464+
expect_ok(config, &["rustup", "component", "add", "rls"]);
465+
466+
expect_ok(config, &["rls", "--version"]);
467+
});
468+
}
469+
470+
#[test]
471+
fn run_rls_when_not_installed() {
449472
setup(&|config| {
450473
expect_ok(config, &["rustup", "default", "stable"]);
451474
expect_err(

0 commit comments

Comments
 (0)