Skip to content

Commit 3f57299

Browse files
committed
test(cli): ensure the resolution of #3737
1 parent d2baac2 commit 3f57299

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/suite/cli_misc.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,33 @@ fn rename_rls_remove() {
677677
});
678678
}
679679

680+
// issue #3737
681+
/// `~/.rustup/toolchains` is permitted to be a symlink.
682+
#[test]
683+
#[cfg(any(unix, windows))]
684+
fn toolchains_symlink() {
685+
use rustup::utils::raw::symlink_dir;
686+
use std::fs;
687+
688+
clitools::test(Scenario::SimpleV2, &|config| {
689+
let cwd = config.current_dir();
690+
let test_toolchains = cwd.join("toolchains-test");
691+
fs::create_dir(&test_toolchains).unwrap();
692+
symlink_dir(&test_toolchains, &config.rustupdir.join("toolchains")).unwrap();
693+
694+
config.expect_ok(&["rustup", "default", "nightly"]);
695+
config.expect_ok_contains(&["rustup", "toolchain", "list"], "nightly", "");
696+
config.expect_ok_contains(&["rustc", "--version"], "hash-nightly-2", "");
697+
config.expect_ok(&["rustup", "toolchain", "uninstall", "nightly"]);
698+
config.expect_stdout_ok(
699+
&["rustup", "toolchain", "list"],
700+
"no installed toolchains\n",
701+
);
702+
});
703+
}
704+
680705
// issue #1169
706+
/// A toolchain that is a stale symlink should be correctly uninstalled.
681707
#[test]
682708
#[cfg(any(unix, windows))]
683709
fn toolchain_broken_symlink() {

0 commit comments

Comments
 (0)