Merge branch 'simple-enum' of git.hitchhiker-linux.org:jeang3nie/version-rs into simple-enum
This commit is contained in:
commit
b40178ede2
@ -211,7 +211,7 @@ impl PartialOrd for Version {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::num::NonZeroU16;
|
||||
use std::{num::NonZeroU16, str::FromStr};
|
||||
|
||||
#[test]
|
||||
fn from_str() {
|
||||
@ -272,4 +272,19 @@ mod tests {
|
||||
let version: Version = s.parse().unwrap();
|
||||
assert_eq!(s, version.to_string());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cmp() {
|
||||
let astr = "3.14.0-x86_64";
|
||||
let bstr = "3.14.0_alpha1-x86_64";
|
||||
let cstr = "3.14_alpha1-amd64";
|
||||
let dstr = "3.14.0_beta3-x86_64";
|
||||
let estr = "3.14.0_git_c3poxxx.1705881493-x86_64";
|
||||
let fstr = "3.14.0_git_r2d2xxx.1705900000-x86_64";
|
||||
assert!(Version::from_str(astr).unwrap() > Version::from_str(bstr).unwrap());
|
||||
assert!(Version::from_str(cstr).unwrap() == Version::from_str(bstr).unwrap());
|
||||
assert!(Version::from_str(cstr).unwrap() < Version::from_str(dstr).unwrap());
|
||||
assert!(Version::from_str(dstr).unwrap() > Version::from_str(estr).unwrap());
|
||||
assert!(Version::from_str(fstr).unwrap() > Version::from_str(estr).unwrap());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user