take at least 1 version suffix to prevent allowing versions such as 1.0_

This commit is contained in:
John Turner
2025-11-14 19:27:19 +00:00
parent 50ab68c9c5
commit 85853ada1e

View File

@@ -87,7 +87,7 @@ impl<'a> Parseable<'a, &'a str> for VersionSuffixes {
fn parser() -> Self::Parser {
VersionSuffix::parser()
.separated_by(tag("_"))
.many()
.at_least(1)
.map(|suffixes| VersionSuffixes(suffixes))
}
}
@@ -486,4 +486,11 @@ mod test {
Cpv::parser().check_finished(it).unwrap();
}
#[test]
fn test_cpv_without_version_but_trailing_almost_version() {
let it = InputIter::new("dev-perl/mod-p-2.3_");
assert!(Cpv::parser().parse_finished(it).is_err());
}
}