Skip to content

Commit

Permalink
Test reverse coercion by indirect dep
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita240 committed Mar 5, 2024
1 parent c97b7a7 commit 4a6bc65
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions crates/resolver-tests/tests/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,50 @@ fn test_wildcard_major_coerced_by_subdepdency() {
);
}

#[test]
fn test_wildcard_major_coerced_by_indirect_subdepdency() {
let reg = registry(vec![
pkg!("foo" => [dep_req("util", "0.1")]),
pkg!("bar" => [dep_req("car", "1.0.0")]),
pkg!("car" => [dep_req("util", "0.2")]),
pkg!(("util", "0.1.0")),
pkg!(("util", "0.2.0")),
pkg!(("util", "0.3.0")),
]);

let res = resolve_with_global_context_raw(
vec![
dep_req("foo", "1.0.0"),
dep_req("bar", "1.0.0"),
dep_req("util", "0.*"),
],
&reg,
&GlobalContext::default().unwrap(),
)
.unwrap();

// In this case, 0.1.0, 0.2.0 and 0.3.0 satisfy root. It should pick the highest
// version that exists in the dependency tree.
assert_eq!(
res.deps(pkg_id("root")).skip(2).next().unwrap().0,
("util", "0.2.0").to_pkgid()
);

let res = res.sort();

assert_same(
&res,
&names(&[
("root", "1.0.0"),
("foo", "1.0.0"),
("bar", "1.0.0"),
("car", "1.0.0"),
("util", "0.1.0"),
("util", "0.2.0"),
]),
);
}

#[test]
fn test_range_major() {
let reg = registry(vec![
Expand Down

0 comments on commit 4a6bc65

Please sign in to comment.