forked from gentoo-utils/gentoo-utils
take at least 1 version suffix to prevent allowing versions such as 1.0_
This commit is contained in:
@@ -87,7 +87,7 @@ impl<'a> Parseable<'a, &'a str> for VersionSuffixes {
|
|||||||
fn parser() -> Self::Parser {
|
fn parser() -> Self::Parser {
|
||||||
VersionSuffix::parser()
|
VersionSuffix::parser()
|
||||||
.separated_by(tag("_"))
|
.separated_by(tag("_"))
|
||||||
.many()
|
.at_least(1)
|
||||||
.map(|suffixes| VersionSuffixes(suffixes))
|
.map(|suffixes| VersionSuffixes(suffixes))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -486,4 +486,11 @@ mod test {
|
|||||||
|
|
||||||
Cpv::parser().check_finished(it).unwrap();
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user