Skip to content

Commit

Permalink
test(cli): ensure the resolution of #3737
Browse files Browse the repository at this point in the history
  • Loading branch information
rami3l committed Mar 27, 2024
1 parent ba6b5d0 commit 29ce9ee
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/suite/cli_misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,45 @@ info: toolchain 'test' uninstalled
});
}

// issue #3737
#[test]
#[cfg(any(unix, windows))]
fn toolchain_symlink() {
use rustup::utils::raw::symlink_dir;
use std::fs;

clitools::test(Scenario::SimpleV2, &|config| {
config.expect_ok(&["rustup", "toolchain", "install", "nightly"]);

let cwd = config.current_dir();
let test_rustupdir = cwd.join("rustup-test");
let test_toolchains = test_rustupdir.join("toolchains");
fs::create_dir_all(&test_toolchains).unwrap();
symlink_dir(&config.rustupdir.join("toolchains"), &test_toolchains).unwrap();

let home_override = &[("RUSTUP_HOME", test_rustupdir.to_str().unwrap())];

let out = config.run("rustup", ["toolchain", "list"], home_override);
assert!(out.ok);
assert!(out.stdout.contains("nightly"));

let out = config.run("rustc", ["+nightly", "--version"], home_override);
assert!(out.ok);
assert!(out.stdout.contains("hash-nightly-2"));

let out = config.run(
"rustup",
["toolchain", "uninstall", "nightly"],
home_override,
);
assert!(out.ok);
config.expect_stdout_ok(
&["rustup", "toolchain", "list"],
"no installed toolchains\n",
);
});
}

// issue #1297
#[test]
fn update_unavailable_rustc() {
Expand Down

0 comments on commit 29ce9ee

Please sign in to comment.