Skip to content

Commit 4a05a5e

Browse files
committed
tests: Add tests for component-target support
1 parent 8595201 commit 4a05a5e

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

tests/cli-v2.rs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,59 @@ fn add_all_targets_fail() {
678678
});
679679
}
680680

681+
#[test]
682+
fn add_target_by_component_add() {
683+
setup(&|config| {
684+
expect_ok(config, &["rustup", "default", "nightly"]);
685+
expect_not_stdout_ok(
686+
config,
687+
&["rustup", "target", "list"],
688+
&format!("{} (installed)", clitools::CROSS_ARCH1),
689+
);
690+
expect_ok(
691+
config,
692+
&[
693+
"rustup",
694+
"component",
695+
"add",
696+
&format!("rust-std-{}", clitools::CROSS_ARCH1),
697+
],
698+
);
699+
expect_stdout_ok(
700+
config,
701+
&["rustup", "target", "list"],
702+
&format!("{} (installed)", clitools::CROSS_ARCH1),
703+
);
704+
})
705+
}
706+
707+
#[test]
708+
fn remove_target_by_component_remove() {
709+
setup(&|config| {
710+
expect_ok(config, &["rustup", "default", "nightly"]);
711+
expect_ok(config, &["rustup", "target", "add", clitools::CROSS_ARCH1]);
712+
expect_stdout_ok(
713+
config,
714+
&["rustup", "target", "list"],
715+
&format!("{} (installed)", clitools::CROSS_ARCH1),
716+
);
717+
expect_ok(
718+
config,
719+
&[
720+
"rustup",
721+
"component",
722+
"remove",
723+
&format!("rust-std-{}", clitools::CROSS_ARCH1),
724+
],
725+
);
726+
expect_not_stdout_ok(
727+
config,
728+
&["rustup", "target", "list"],
729+
&format!("{} (installed)", clitools::CROSS_ARCH1),
730+
);
731+
})
732+
}
733+
681734
#[test]
682735
fn add_target_no_toolchain() {
683736
setup(&|config| {

0 commit comments

Comments
 (0)