Skip to content

Commit 4164c46

Browse files
committed
add a test
1 parent 15c7c08 commit 4164c46

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

tests/testsuite/lockfile_compat.rs

+52
Original file line numberDiff line numberDiff line change
@@ -836,3 +836,55 @@ source = "git+{url}#{sha}"
836836

837837
assert_eq!(p.read_file("Cargo.lock"), lockfile);
838838
}
839+
840+
#[cargo_test]
841+
fn bad_data_in_lockfile_error_meg() {
842+
Package::new("bar", "0.0.1").publish();
843+
844+
let p = project()
845+
.file(
846+
"Cargo.toml",
847+
r#"
848+
[package]
849+
name = "test"
850+
version = "0.0.0"
851+
852+
[dependencies]
853+
bar = "*"
854+
"#,
855+
)
856+
.file("src/main.rs", "fn main() {}")
857+
.file(
858+
"Cargo.lock",
859+
r#"# This file is automatically @generated by Cargo.
860+
# It is not intended for manual editing.
861+
version = 3
862+
863+
[[package]]
864+
name = "bar"
865+
version = "0.1.0"
866+
source = "registry+https://github.com/rust-lang/crates.io-index"
867+
checksum = "8e1b9346248cf3391ead604c4407258d327c28e37209f6d56127598165165dda"
868+
869+
[[package]]
870+
name = "test"
871+
version = "0.0.0"
872+
dependencies = [
873+
"bar",
874+
]"#,
875+
)
876+
.build();
877+
p.cargo("build")
878+
.with_status(101)
879+
.with_stderr(
880+
"\
881+
[..]
882+
[ERROR] failed to select a version for the requirement `bar = \"*\"` (locked to 0.1.0)
883+
candidate versions found which didn't match: 0.0.1
884+
location searched: `dummy-registry` index (which is replacing registry `crates-io`)
885+
required by package `test v0.0.0 ([..])`
886+
perhaps a crate was updated and forgotten to be re-vendored?
887+
",
888+
)
889+
.run();
890+
}

0 commit comments

Comments
 (0)