[domistream] Tests: properties cannot pass against Unimplemented

The never-panic properties (XML, RTSP, ENet, control, input, media) and the
allocation-cap checks only asserted inside `if let Ok`, so a stub returning
Unimplemented for everything passed them. Each now also requires the parser
to answer something other than Unimplemented (common::implemented); the XML
truncation property wants Malformed or Truncated, not any error.
This commit is contained in:
2026-11-25 13:15:00 +01:00
parent 2740d3dd45
commit e67daea536
8 changed files with 94 additions and 112 deletions
+5 -2
View File
@@ -281,7 +281,9 @@ proptest! {
/// Arbitrary bytes: never panics; any success respects every cap.
#[test]
fn xml_never_panics_and_respects_caps(data in proptest::collection::vec(any::<u8>(), 0..2048)) {
if let Ok(d) = xml::parse(&data) {
let parsed = xml::parse(&data);
prop_assert!(common::implemented(&parsed));
if let Ok(d) = parsed {
fn walk(e: &xml::Element, depth: usize, count: &mut usize) -> bool {
*count += 1;
depth <= MAX_XML_DEPTH
@@ -301,7 +303,8 @@ proptest! {
fn xml_truncation_is_an_error(cut in 0usize..60) {
let doc = br#"<root status_code="200"><a k="v">text&amp;</a><b/></root>"#;
let cut = cut.min(doc.len() - 1);
prop_assert!(xml::parse(&doc[..cut]).is_err());
let r = xml::parse(&doc[..cut]);
prop_assert!(matches!(r, Err(Error::Malformed { .. } | Error::Truncated { .. })), "{:?}", r);
}
}