diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /src/tools/cargo/tests/testsuite/install.rs | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/cargo/tests/testsuite/install.rs')
-rw-r--r-- | src/tools/cargo/tests/testsuite/install.rs | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/src/tools/cargo/tests/testsuite/install.rs b/src/tools/cargo/tests/testsuite/install.rs index 0a3670e6c..fd53b607b 100644 --- a/src/tools/cargo/tests/testsuite/install.rs +++ b/src/tools/cargo/tests/testsuite/install.rs @@ -58,6 +58,28 @@ fn simple() { } #[cargo_test] +fn install_the_same_version_twice() { + pkg("foo", "0.0.1"); + + cargo_process("install foo foo") + .with_stderr( + "\ +[UPDATING] `[..]` index +[DOWNLOADING] crates ... +[DOWNLOADED] foo v0.0.1 (registry [..]) +[INSTALLING] foo v0.0.1 +[COMPILING] foo v0.0.1 +[FINISHED] release [optimized] target(s) in [..] +[INSTALLING] [CWD]/home/.cargo/bin/foo[EXE] +[INSTALLED] package `foo v0.0.1` (executable `foo[EXE]`) +[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries +", + ) + .run(); + assert_has_installed_exe(cargo_home(), "foo"); +} + +#[cargo_test] fn toolchain() { pkg("foo", "0.0.1"); @@ -1614,7 +1636,7 @@ fn inline_version_without_name() { cargo_process("install @0.1.1") .with_status(1) .with_stderr( - "error: invalid value '@0.1.1' for '[crate]...': missing crate name before '@' + "error: invalid value '@0.1.1' for '[CRATE[@<VER>]]...': missing crate name before '@' For more information, try '--help'. ", @@ -1844,7 +1866,9 @@ fn install_empty_argument() { cargo_process("install") .arg("") .with_status(1) - .with_stderr_contains("[ERROR] invalid value '' for '[crate]...': crate name is empty") + .with_stderr_contains( + "[ERROR] invalid value '' for '[CRATE[@<VER>]]...': crate name is empty", + ) .run(); } @@ -2455,7 +2479,7 @@ error: unexpected argument '--release' found tip: `--release` is the default for `cargo install`; instead `--debug` is supported -Usage: cargo[EXE] install [OPTIONS] [crate]... +Usage: cargo[EXE] install [OPTIONS] [CRATE[@<VER>]]... For more information, try '--help'. ", @@ -2463,3 +2487,23 @@ For more information, try '--help'. .with_status(1) .run(); } + +#[cargo_test] +fn install_incompat_msrv() { + Package::new("foo", "0.1.0") + .file("src/main.rs", "fn main() {}") + .rust_version("1.30") + .publish(); + Package::new("foo", "0.2.0") + .file("src/main.rs", "fn main() {}") + .rust_version("1.9876.0") + .publish(); + + cargo_process("install foo") + .with_stderr("\ +[UPDATING] `dummy-registry` index +[ERROR] cannot install package `foo 0.2.0`, it requires rustc 1.9876.0 or newer, while the currently active rustc version is [..] +`foo 0.1.0` supports rustc 1.30 +") + .with_status(101).run(); +} |