Add dedicated tests for the max local version sentinel (#8869)
This commit is contained in:
committed by
Zanie Blue
parent
a80b6f51b0
commit
4d760ac1f9
@@ -1149,6 +1149,39 @@ fn ordering() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn local_sentinel_version() {
|
||||
let sentinel = Version::new([1, 0]).with_local(LocalVersion::Max);
|
||||
|
||||
// Ensure that the "max local version" sentinel is less than the following versions.
|
||||
let versions = &["1.0.post0", "1.1"];
|
||||
|
||||
for greater in versions {
|
||||
let greater = greater.parse::<Version>().unwrap();
|
||||
assert_eq!(
|
||||
sentinel.cmp(&greater),
|
||||
Ordering::Less,
|
||||
"less: {:?}\ngreater: {:?}",
|
||||
greater.as_bloated_debug(),
|
||||
sentinel.as_bloated_debug(),
|
||||
);
|
||||
}
|
||||
|
||||
// Ensure that the "max local version" sentinel is greater than the following versions.
|
||||
let versions = &["1.0", "1.0.a0", "1.0+local"];
|
||||
|
||||
for less in versions {
|
||||
let less = less.parse::<Version>().unwrap();
|
||||
assert_eq!(
|
||||
sentinel.cmp(&less),
|
||||
Ordering::Greater,
|
||||
"less: {:?}\ngreater: {:?}",
|
||||
sentinel.as_bloated_debug(),
|
||||
less.as_bloated_debug()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn min_version() {
|
||||
// Ensure that the `.min` suffix precedes all other suffixes.
|
||||
|
||||
Reference in New Issue
Block a user