Skip to content

Commit 4f1e41e

Browse files
committed
test(update): demonstrate not able to update --precise <yanked>
1 parent 515f6e3 commit 4f1e41e

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/testsuite/update.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,3 +1370,40 @@ fn update_precise_git_revisions() {
13701370
assert!(p.read_lockfile().contains(&head_id));
13711371
assert!(!p.read_lockfile().contains(&tag_commit_id));
13721372
}
1373+
1374+
#[cargo_test]
1375+
fn precise_yanked() {
1376+
Package::new("bar", "0.1.0").publish();
1377+
Package::new("bar", "0.1.1").yanked(true).publish();
1378+
let p = project()
1379+
.file(
1380+
"Cargo.toml",
1381+
r#"
1382+
[package]
1383+
name = "foo"
1384+
1385+
[dependencies]
1386+
bar = "0.1"
1387+
"#,
1388+
)
1389+
.file("src/lib.rs", "")
1390+
.build();
1391+
1392+
p.cargo("generate-lockfile").run();
1393+
1394+
// Use non-yanked version.
1395+
let lockfile = p.read_lockfile();
1396+
assert!(lockfile.contains("\nname = \"bar\"\nversion = \"0.1.0\""));
1397+
1398+
p.cargo("update --precise 0.1.1 bar")
1399+
.with_status(101)
1400+
.with_stderr(
1401+
"\
1402+
[UPDATING] `dummy-registry` index
1403+
[ERROR] no matching package named `bar` found
1404+
location searched: registry `crates-io`
1405+
required by package `foo v0.0.0 ([CWD])`
1406+
",
1407+
)
1408+
.run()
1409+
}

0 commit comments

Comments
 (0)