summaryrefslogtreecommitdiffstats
path: root/src/tools/cargo/tests/testsuite/registry.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/cargo/tests/testsuite/registry.rs')
-rw-r--r--src/tools/cargo/tests/testsuite/registry.rs67
1 files changed, 52 insertions, 15 deletions
diff --git a/src/tools/cargo/tests/testsuite/registry.rs b/src/tools/cargo/tests/testsuite/registry.rs
index 8982b1cb6..f485180c9 100644
--- a/src/tools/cargo/tests/testsuite/registry.rs
+++ b/src/tools/cargo/tests/testsuite/registry.rs
@@ -807,7 +807,7 @@ required by package `foo v0.0.1 ([..])`
)
.run();
- p.cargo("update -p baz")
+ p.cargo("update baz")
.with_stderr_contains(
"\
[UPDATING] `[..]` index
@@ -952,7 +952,7 @@ fn update_lockfile() {
Package::new("bar", "0.0.3").publish();
paths::home().join(".cargo/registry").rm_rf();
println!("0.0.2 update");
- p.cargo("update -p bar --precise 0.0.2")
+ p.cargo("update bar --precise 0.0.2")
.with_stderr(
"\
[UPDATING] `[..]` index
@@ -975,7 +975,7 @@ fn update_lockfile() {
.run();
println!("0.0.3 update");
- p.cargo("update -p bar")
+ p.cargo("update bar")
.with_stderr(
"\
[UPDATING] `[..]` index
@@ -1000,7 +1000,7 @@ fn update_lockfile() {
println!("new dependencies update");
Package::new("bar", "0.0.4").dep("spam", "0.2.5").publish();
Package::new("spam", "0.2.5").publish();
- p.cargo("update -p bar")
+ p.cargo("update bar")
.with_stderr(
"\
[UPDATING] `[..]` index
@@ -1012,7 +1012,7 @@ fn update_lockfile() {
println!("new dependencies update");
Package::new("bar", "0.0.5").publish();
- p.cargo("update -p bar")
+ p.cargo("update bar")
.with_stderr(
"\
[UPDATING] `[..]` index
@@ -1433,7 +1433,7 @@ fn update_transitive_dependency() {
Package::new("b", "0.1.1").publish();
- p.cargo("update -pb")
+ p.cargo("update b")
.with_stderr(
"\
[UPDATING] `[..]` index
@@ -1504,7 +1504,7 @@ fn update_backtracking_ok() {
.dep("cookie", "0.1.0")
.publish();
- p.cargo("update -p hyper")
+ p.cargo("update hyper")
.with_stderr(
"\
[UPDATING] `[..]` index
@@ -1555,7 +1555,7 @@ fn update_multiple_packages() {
Package::new("b", "0.1.1").publish();
Package::new("c", "0.1.1").publish();
- p.cargo("update -pa -pb")
+ p.cargo("update a b")
.with_stderr(
"\
[UPDATING] `[..]` index
@@ -1565,7 +1565,7 @@ fn update_multiple_packages() {
)
.run();
- p.cargo("update -pb -pc")
+ p.cargo("update b c")
.with_stderr(
"\
[UPDATING] `[..]` index
@@ -1671,7 +1671,7 @@ fn update_same_prefix_oh_my_how_was_this_a_bug() {
.publish();
p.cargo("generate-lockfile").run();
- p.cargo("update -pfoobar --precise=0.2.0").run();
+ p.cargo("update foobar --precise=0.2.0").run();
}
#[cargo_test]
@@ -1756,12 +1756,12 @@ fn use_semver_package_incorrectly() {
.with_status(101)
.with_stderr(
"\
-error: no matching package found
-searched package name: `a`
-prerelease package needs to be specified explicitly
-a = { version = \"0.1.1-alpha.0\" }
+error: failed to select a version for the requirement `a = \"^0.1\"`
+candidate versions found which didn't match: 0.1.1-alpha.0
location searched: [..]
required by package `b v0.1.0 ([..])`
+if you are looking for the prerelease package it needs to be specified explicitly
+ a = { version = \"0.1.1-alpha.0\" }
",
)
.run();
@@ -2604,7 +2604,9 @@ fn ignores_unknown_index_version_git() {
fn ignores_unknown_index_version() {
// If the version field is not understood, it is ignored.
Package::new("bar", "1.0.0").publish();
- Package::new("bar", "1.0.1").schema_version(9999).publish();
+ Package::new("bar", "1.0.1")
+ .schema_version(u32::MAX)
+ .publish();
let p = project()
.file(
@@ -2631,6 +2633,41 @@ fn ignores_unknown_index_version() {
}
#[cargo_test]
+fn unknown_index_version_error() {
+ // If the version field is not understood, it is ignored.
+ Package::new("bar", "1.0.1")
+ .schema_version(u32::MAX)
+ .publish();
+
+ let p = project()
+ .file(
+ "Cargo.toml",
+ r#"
+ [package]
+ name = "foo"
+ version = "0.1.0"
+
+ [dependencies]
+ bar = "1.0"
+ "#,
+ )
+ .file("src/lib.rs", "")
+ .build();
+
+ p.cargo("generate-lockfile")
+ .with_status(101)
+ .with_stderr(
+ "\
+[UPDATING] `dummy-registry` index
+[ERROR] no matching package named `bar` found
+location searched: registry `crates-io`
+required by package `foo v0.1.0 ([CWD])`
+",
+ )
+ .run();
+}
+
+#[cargo_test]
fn protocol() {
cargo_process("install bar")
.with_status(101)