diff --git a/crates/resolver-tests/tests/resolve.rs b/crates/resolver-tests/tests/resolve.rs index 189a16d0e080..62963aa3b86b 100644 --- a/crates/resolver-tests/tests/resolve.rs +++ b/crates/resolver-tests/tests/resolve.rs @@ -790,6 +790,34 @@ fn resolving_with_sys_crates() { let res = resolve(vec![dep_req("d", "1"), dep_req("r", "1")], ®).unwrap(); + assert_same( + &res, + &names(&[ + ("root", "1.0.0"), + ("d", "1.0.0"), + ("r", "1.0.0"), + ("l-sys", "0.9.1"), + ("l", "0.9.1"), + ]), + ); +} + +#[test] +fn resolving_with_sys_crates_duplicates() { + // This is based on issues/4902 + // With `l` a normal library we get 2copies so everyone gets the newest compatible. + // But `l-sys` a library with a links attribute we make sure there is only one. + let reg = registry(vec![ + pkg!(("l-sys", "0.9.1")), + pkg!(("l-sys", "0.10.0")), + pkg!(("l", "0.9.1") => [dep_req("l-sys", ">=0.8.0, <=0.10.0")]), + pkg!(("l", "0.10.0") => [dep_req("l-sys", "0.9")]), + pkg!(("d", "1.0.0") => [dep_req("l", "0.10")]), + pkg!(("r", "1.0.0") => [dep_req("l", "0.9")]), + ]); + + let res = resolve(vec![dep_req("d", "1"), dep_req("r", "1")], ®).unwrap(); + assert_same( &res, &names(&[