forked from gentoo-utils/gentoo-utils
disallow upper case letters in versions
This commit is contained in:
@@ -51,7 +51,9 @@ pub fn version<'a>() -> impl Parser<&'a str, Output = Version> {
|
||||
let rev = version_number().preceded_by(tag("-r"));
|
||||
|
||||
numbers
|
||||
.and(opt(r#if(|c: &char| c.is_ascii_alphabetic())))
|
||||
.and(opt(r#if(|c: &char| {
|
||||
c.is_ascii_alphabetic() && c.is_ascii_lowercase()
|
||||
})))
|
||||
.and(opt(suffixes.preceded_by(tag("_"))))
|
||||
.and(opt(rev))
|
||||
.map(|(((numbers, letter), suffixes), rev)| Version {
|
||||
@@ -287,4 +289,11 @@ mod test {
|
||||
|
||||
atom().check_finished(it).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_version_with_uppercase_letter() {
|
||||
let it = InputIter::new("foo/bar-1.0.0V");
|
||||
|
||||
assert!(atom().check_finished(it).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user