Skip to content

Commit 20f55af

Browse files
committed
test that minimal-versions errors on the same input as normal resolution
1 parent 9955f82 commit 20f55af

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

tests/testsuite/resolve.rs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ proptest! {
3333
},
3434
.. ProptestConfig::default()
3535
})]
36+
3637
#[test]
3738
fn passes_validation(
3839
PrettyPrintRegistry(input) in registry_strategy(50, 20, 60)
@@ -49,6 +50,56 @@ proptest! {
4950
);
5051
}
5152
}
53+
54+
#[test]
55+
fn minimum_version_errors_the_same(
56+
PrettyPrintRegistry(input) in registry_strategy(50, 20, 60)
57+
) {
58+
enable_nightly_features();
59+
60+
let mut config = Config::default().unwrap();
61+
config
62+
.configure(
63+
1,
64+
None,
65+
&None,
66+
false,
67+
false,
68+
&None,
69+
&["minimal-versions".to_string()],
70+
)
71+
.unwrap();
72+
73+
let reg = registry(input.clone());
74+
// there is only a small chance that eny one
75+
// crate will be interesting.
76+
// So we try some of the most complicated.
77+
for this in input.iter().rev().take(10) {
78+
// minimal-versions change what order the candidates
79+
// are tried but not the existence of a solution
80+
let res = resolve(
81+
&pkg_id("root"),
82+
vec![dep_req(&this.name(), &format!("={}", this.version()))],
83+
&reg,
84+
);
85+
86+
let mres = resolve_with_config(
87+
&pkg_id("root"),
88+
vec![dep_req(&this.name(), &format!("={}", this.version()))],
89+
&reg,
90+
Some(&config),
91+
);
92+
93+
prop_assert_eq!(
94+
res.is_ok(),
95+
mres.is_ok(),
96+
"minimal-versions and regular resolver disagree about weather `{} = \"={}\"` can resolve",
97+
this.name(),
98+
this.version()
99+
)
100+
}
101+
}
102+
52103
#[test]
53104
fn limited_independence_of_irrelevant_alternatives(
54105
PrettyPrintRegistry(input) in registry_strategy(50, 20, 60),

0 commit comments

Comments
 (0)