Skip to content

Commit c97b7a7

Browse files
committed
Add a test for coercion by dependency
1 parent 7c7df1c commit c97b7a7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

crates/resolver-tests/tests/resolve.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,24 @@ fn test_wildcard_major_duplicate_selection() {
511511
);
512512
}
513513

514+
#[test]
515+
fn test_wildcard_major_coerced_by_subdepdency() {
516+
let reg = registry(vec![
517+
pkg!("foo" => [dep_req("util", "0.1")]),
518+
pkg!(("util", "0.1.0")),
519+
pkg!(("util", "0.2.0")),
520+
]);
521+
522+
let res = resolve(vec![dep_req("foo", "1.0.0"), dep_req("util", "0.*")], &reg).unwrap();
523+
524+
// In this case, both 0.1.0 and 0.2.0 satisfy root, but it's being coerced
525+
// by the subdependency of foo.
526+
assert_same(
527+
&res,
528+
&names(&[("root", "1.0.0"), ("foo", "1.0.0"), ("util", "0.1.0")]),
529+
);
530+
}
531+
514532
#[test]
515533
fn test_range_major() {
516534
let reg = registry(vec![

0 commit comments

Comments
 (0)