Skip to content

Commit

Permalink
Test file_override_beats_existing_toolchain()
Browse files Browse the repository at this point in the history
  • Loading branch information
rami3l committed Nov 4, 2023
1 parent 60e0b76 commit 2e24b25
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/suite/cli_rustup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2027,6 +2027,49 @@ fn plus_override_beats_file_override() {
});
}

// Ensures that the specified toolchain components and targets still work even if the toolchain is already installed.
// See: <https://github.com/rust-lang/rustup/pull/3492#issuecomment-1793382483>
#[test]
fn file_override_beats_existing_toolchain() {
use clitools::MULTI_ARCH1;

test(&|config| {
config.with_scenario(Scenario::MultiHost, &|config| {
let beta = "hash-beta-1.2.0";
config.expect_ok(&[
"rustup",
"toolchain",
"install",
"beta",
"--profile=minimal",
]);
config.expect_ok(&["rustup", "override", "set", "beta"]);

let cwd = config.current_dir();
let toolchain_file = cwd.join("rust-toolchain.toml");
raw::write_file(
&toolchain_file,
&format!(
r#"
[toolchain]
channel = "beta"
components = [ "rls" ]
targets = [ "{MULTI_ARCH1}" ]
"#,
),
)
.unwrap();

// Implicitly install the missing components and targets.
config.expect_stdout_ok(&["rustc", "--version"], beta);

let list_installed = &["rustup", "component", "list", "--installed"];
config.expect_stdout_ok(list_installed, "rls-");
config.expect_stdout_ok(list_installed, &format!("rust-std-{MULTI_ARCH1}"));
})
});
}

#[test]
fn file_override_not_installed_custom() {
test(&|config| {
Expand Down

0 comments on commit 2e24b25

Please sign in to comment.