From 4a05a5e3a4657400c57e67bee2f041b19c34e6da Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 26 Oct 2019 15:02:07 +0100 Subject: [PATCH] tests: Add tests for component-target support --- tests/cli-v2.rs | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/cli-v2.rs b/tests/cli-v2.rs index 4706cc5274e..b10adf91121 100644 --- a/tests/cli-v2.rs +++ b/tests/cli-v2.rs @@ -678,6 +678,59 @@ fn add_all_targets_fail() { }); } +#[test] +fn add_target_by_component_add() { + setup(&|config| { + expect_ok(config, &["rustup", "default", "nightly"]); + expect_not_stdout_ok( + config, + &["rustup", "target", "list"], + &format!("{} (installed)", clitools::CROSS_ARCH1), + ); + expect_ok( + config, + &[ + "rustup", + "component", + "add", + &format!("rust-std-{}", clitools::CROSS_ARCH1), + ], + ); + expect_stdout_ok( + config, + &["rustup", "target", "list"], + &format!("{} (installed)", clitools::CROSS_ARCH1), + ); + }) +} + +#[test] +fn remove_target_by_component_remove() { + setup(&|config| { + expect_ok(config, &["rustup", "default", "nightly"]); + expect_ok(config, &["rustup", "target", "add", clitools::CROSS_ARCH1]); + expect_stdout_ok( + config, + &["rustup", "target", "list"], + &format!("{} (installed)", clitools::CROSS_ARCH1), + ); + expect_ok( + config, + &[ + "rustup", + "component", + "remove", + &format!("rust-std-{}", clitools::CROSS_ARCH1), + ], + ); + expect_not_stdout_ok( + config, + &["rustup", "target", "list"], + &format!("{} (installed)", clitools::CROSS_ARCH1), + ); + }) +} + #[test] fn add_target_no_toolchain() { setup(&|config| {