forked from gentoo-utils/gentoo-utils
verify that slot exprs have either a primary slot name or operator
This commit is contained in:
@@ -185,6 +185,12 @@ impl<'a> Parseable<'a, &'a str> for Slot {
|
||||
sub,
|
||||
operator,
|
||||
})
|
||||
.verify_output(|slot| {
|
||||
matches!(
|
||||
(&slot.primary(), &slot.operator()),
|
||||
(Some(_) | None, Some(_)) | (Some(_), None)
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,9 +426,9 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn test_empty_slot() {
|
||||
let it = InputIter::new("foo/bar:=");
|
||||
let it = InputIter::new("=dev-ml/uucp-17*:");
|
||||
|
||||
Atom::parser().check_finished(it).unwrap();
|
||||
assert!(Atom::parser().check_finished(it).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -494,4 +500,11 @@ mod test {
|
||||
|
||||
assert!(Cpv::parser().parse_finished(it).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_empty_slot_with_operator() {
|
||||
let it = InputIter::new("foo/bar:=");
|
||||
|
||||
Atom::parser().check_finished(it).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user