Skip to content

Commit

Permalink
add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Eh2406 committed Mar 3, 2022
1 parent 15c7c08 commit 4164c46
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/testsuite/lockfile_compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -836,3 +836,55 @@ source = "git+{url}#{sha}"

assert_eq!(p.read_file("Cargo.lock"), lockfile);
}

#[cargo_test]
fn bad_data_in_lockfile_error_meg() {
Package::new("bar", "0.0.1").publish();

let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "test"
version = "0.0.0"
[dependencies]
bar = "*"
"#,
)
.file("src/main.rs", "fn main() {}")
.file(
"Cargo.lock",
r#"# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "bar"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e1b9346248cf3391ead604c4407258d327c28e37209f6d56127598165165dda"
[[package]]
name = "test"
version = "0.0.0"
dependencies = [
"bar",
]"#,
)
.build();
p.cargo("build")
.with_status(101)
.with_stderr(
"\
[..]
[ERROR] failed to select a version for the requirement `bar = \"*\"` (locked to 0.1.0)
candidate versions found which didn't match: 0.0.1
location searched: `dummy-registry` index (which is replacing registry `crates-io`)
required by package `test v0.0.0 ([..])`
perhaps a crate was updated and forgotten to be re-vendored?
",
)
.run();
}

0 comments on commit 4164c46

Please sign in to comment.