Skip to content

Commit 2e24b25

Browse files
committed
Test file_override_beats_existing_toolchain()
1 parent 60e0b76 commit 2e24b25

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/suite/cli_rustup.rs

+43
Original file line numberDiff line numberDiff line change
@@ -2027,6 +2027,49 @@ fn plus_override_beats_file_override() {
20272027
});
20282028
}
20292029

2030+
// Ensures that the specified toolchain components and targets still work even if the toolchain is already installed.
2031+
// See: <https://github.com/rust-lang/rustup/pull/3492#issuecomment-1793382483>
2032+
#[test]
2033+
fn file_override_beats_existing_toolchain() {
2034+
use clitools::MULTI_ARCH1;
2035+
2036+
test(&|config| {
2037+
config.with_scenario(Scenario::MultiHost, &|config| {
2038+
let beta = "hash-beta-1.2.0";
2039+
config.expect_ok(&[
2040+
"rustup",
2041+
"toolchain",
2042+
"install",
2043+
"beta",
2044+
"--profile=minimal",
2045+
]);
2046+
config.expect_ok(&["rustup", "override", "set", "beta"]);
2047+
2048+
let cwd = config.current_dir();
2049+
let toolchain_file = cwd.join("rust-toolchain.toml");
2050+
raw::write_file(
2051+
&toolchain_file,
2052+
&format!(
2053+
r#"
2054+
[toolchain]
2055+
channel = "beta"
2056+
components = [ "rls" ]
2057+
targets = [ "{MULTI_ARCH1}" ]
2058+
"#,
2059+
),
2060+
)
2061+
.unwrap();
2062+
2063+
// Implicitly install the missing components and targets.
2064+
config.expect_stdout_ok(&["rustc", "--version"], beta);
2065+
2066+
let list_installed = &["rustup", "component", "list", "--installed"];
2067+
config.expect_stdout_ok(list_installed, "rls-");
2068+
config.expect_stdout_ok(list_installed, &format!("rust-std-{MULTI_ARCH1}"));
2069+
})
2070+
});
2071+
}
2072+
20302073
#[test]
20312074
fn file_override_not_installed_custom() {
20322075
test(&|config| {

0 commit comments

Comments
 (0)