Skip to content

Commit 397f446

Browse files
committed
Add test for installing the same binary twice
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
1 parent d2f6a04 commit 397f446

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/testsuite/install.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,34 @@ fn simple() {
5757
assert_has_not_installed_exe(cargo_home(), "foo");
5858
}
5959

60+
#[cargo_test]
61+
fn install_the_same_version_twice() {
62+
pkg("foo", "0.0.1");
63+
64+
cargo_process("install foo foo")
65+
.with_stderr(
66+
"\
67+
[UPDATING] `[..]` index
68+
[DOWNLOADING] crates ...
69+
[DOWNLOADED] foo v0.0.1 (registry [..])
70+
[INSTALLING] foo v0.0.1
71+
[COMPILING] foo v0.0.1
72+
[FINISHED] release [optimized] target(s) in [..]
73+
[INSTALLING] [CWD]/home/.cargo/bin/foo[EXE]
74+
[INSTALLED] package `foo v0.0.1` (executable `foo[EXE]`)
75+
[INSTALLING] foo v0.0.1
76+
[COMPILING] foo v0.0.1
77+
[FINISHED] release [optimized] target(s) in [..]
78+
[REPLACING] [CWD]/home/.cargo/bin/foo[EXE]
79+
[REPLACED] package `foo v0.0.1` with `foo v0.0.1` (executable `foo[EXE]`)
80+
Summary Successfully installed foo, foo!
81+
[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
82+
",
83+
)
84+
.run();
85+
assert_has_installed_exe(cargo_home(), "foo");
86+
}
87+
6088
#[cargo_test]
6189
fn toolchain() {
6290
pkg("foo", "0.0.1");

0 commit comments

Comments
 (0)