Skip to content

Commit 1d7fa10

Browse files
committed
Add tests
1 parent d508232 commit 1d7fa10

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

tests/cli-misc.rs

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,86 @@ fn rename_rls_after() {
588588
});
589589
}
590590

591+
#[test]
592+
fn rename_rls_add_old_name() {
593+
clitools::setup(Scenario::ArchivesV2, &|config| {
594+
set_current_dist_date(config, "2015-01-01");
595+
expect_ok(config, &["rustup", "default", "nightly"]);
596+
597+
set_current_dist_date(config, "2015-01-02");
598+
expect_ok(config, &["rustup", "update", "--no-self-update"]);
599+
expect_ok(config, &["rustup", "component", "add", "rls"]);
600+
601+
assert!(config.exedir.join(format!("rls{}", EXE_SUFFIX)).exists());
602+
expect_ok(config, &["rls", "--version"]);
603+
});
604+
}
605+
606+
#[test]
607+
fn rename_rls_list() {
608+
clitools::setup(Scenario::ArchivesV2, &|config| {
609+
set_current_dist_date(config, "2015-01-01");
610+
expect_ok(config, &["rustup", "default", "nightly"]);
611+
612+
set_current_dist_date(config, "2015-01-02");
613+
expect_ok(config, &["rustup", "update", "--no-self-update"]);
614+
expect_ok(config, &["rustup", "component", "add", "rls"]);
615+
616+
let out = run(
617+
config,
618+
"rustup",
619+
&["component", "list"],
620+
&[],
621+
);
622+
assert!(out.ok);
623+
assert!(out.stdout.contains(&format!("rls-{}", this_host_triple()))
624+
);
625+
});
626+
}
627+
628+
#[test]
629+
fn rename_rls_preview_list() {
630+
clitools::setup(Scenario::ArchivesV2, &|config| {
631+
set_current_dist_date(config, "2015-01-01");
632+
expect_ok(config, &["rustup", "default", "nightly"]);
633+
634+
set_current_dist_date(config, "2015-01-02");
635+
expect_ok(config, &["rustup", "update", "--no-self-update"]);
636+
expect_ok(config, &["rustup", "component", "add", "rls-preview"]);
637+
638+
let out = run(
639+
config,
640+
"rustup",
641+
&["component", "list"],
642+
&[],
643+
);
644+
assert!(out.ok);
645+
assert!(out.stdout.contains(&format!("rls-{}", this_host_triple()))
646+
);
647+
});
648+
}
649+
650+
#[test]
651+
fn rename_rls_remove() {
652+
clitools::setup(Scenario::ArchivesV2, &|config| {
653+
set_current_dist_date(config, "2015-01-01");
654+
expect_ok(config, &["rustup", "default", "nightly"]);
655+
656+
set_current_dist_date(config, "2015-01-02");
657+
expect_ok(config, &["rustup", "update", "--no-self-update"]);
658+
659+
expect_ok(config, &["rustup", "component", "add", "rls"]);
660+
expect_ok(config, &["rls", "--version"]);
661+
expect_ok(config, &["rustup", "component", "remove", "rls"]);
662+
expect_err(config, &["rls", "--version"], "does not have the binary `rls`");
663+
664+
expect_ok(config, &["rustup", "component", "add", "rls"]);
665+
expect_ok(config, &["rls", "--version"]);
666+
expect_ok(config, &["rustup", "component", "remove", "rls-preview"]);
667+
expect_err(config, &["rls", "--version"], "does not have the binary `rls`");
668+
});
669+
}
670+
591671
#[test]
592672
fn install_stops_if_rustc_exists() {
593673
let temp_dir = TempDir::new("fakebin").unwrap();

0 commit comments

Comments
 (0)