Skip to content

Commit 1e0d380

Browse files
committed
Add test for cargo install --index
1 parent 3fbd5ae commit 1e0d380

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

tests/testsuite/install.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use cargo_test_support::install::{
99
assert_has_installed_exe, assert_has_not_installed_exe, cargo_home,
1010
};
1111
use cargo_test_support::paths;
12-
use cargo_test_support::registry::Package;
12+
use cargo_test_support::registry::{registry_path, registry_url, Package};
1313
use cargo_test_support::{
1414
basic_manifest, cargo_process, no_such_file_err_msg, project, symlink_supported, t,
1515
};
@@ -51,6 +51,35 @@ fn simple() {
5151
assert_has_not_installed_exe(cargo_home(), "foo");
5252
}
5353

54+
#[cargo_test]
55+
fn with_index() {
56+
pkg("foo", "0.0.1");
57+
58+
cargo_process("install foo --index")
59+
.arg(registry_url().to_string())
60+
.with_stderr(&format!(
61+
"\
62+
[UPDATING] `{reg}` index
63+
[DOWNLOADING] crates ...
64+
[DOWNLOADED] foo v0.0.1 (registry `{reg}`)
65+
[INSTALLING] foo v0.0.1 (registry `{reg}`)
66+
[COMPILING] foo v0.0.1 (registry `{reg}`)
67+
[FINISHED] release [optimized] target(s) in [..]
68+
[INSTALLING] [CWD]/home/.cargo/bin/foo[EXE]
69+
[INSTALLED] package `foo v0.0.1 (registry `{reg}`)` (executable `foo[EXE]`)
70+
[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
71+
",
72+
reg = registry_path().to_str().unwrap()
73+
))
74+
.run();
75+
assert_has_installed_exe(cargo_home(), "foo");
76+
77+
cargo_process("uninstall foo")
78+
.with_stderr("[REMOVING] [CWD]/home/.cargo/bin/foo[EXE]")
79+
.run();
80+
assert_has_not_installed_exe(cargo_home(), "foo");
81+
}
82+
5483
#[cargo_test]
5584
fn multiple_pkgs() {
5685
pkg("foo", "0.0.1");

0 commit comments

Comments
 (0)