p1-3: pin reviewer probe inputs as regression tests

The quality reviewer named three specific input probes for the C1/C2/
C3 fixes. Encode each as a verbatim test so future regressions on
those exact inputs surface immediately:

- probe_overflow: parse_blocks(b"# h\nbody\n", u32::MAX) → empty +
  Warning::ExtractFailed.
- probe_list_escape: list with embedded code block → single List
  block, two items.
- probe_empty_heading: `# \n# Real\nbody\n` → body's heading_path is
  `["Real"]`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-30 14:42:21 +00:00
parent 2b6d9abc0f
commit 80123e9e27

View File

@@ -1751,3 +1751,37 @@ mod tests {
}
}
}
#[cfg(test)]
mod reviewer_probes {
use super::*;
#[test]
fn probe_overflow() {
let (b, w) = parse_blocks(b"# h\nbody\n", u32::MAX).unwrap();
assert!(b.is_empty(), "expected empty blocks, got {}", b.len());
assert_eq!(w.len(), 1);
assert_eq!(w[0].kind, WarningKind::ExtractFailed);
}
#[test]
fn probe_list_escape() {
let body = b"- item\n\n \x60\x60\x60rust\n fn f(){}\n \x60\x60\x60\n\n- next\n";
let (b, _) = parse_blocks(body, 0).unwrap();
assert_eq!(b.len(), 1, "expected single list block, got {}", b.len());
match &b[0].payload {
ParsedPayload::List { items, .. } => assert_eq!(items.len(), 2),
_ => panic!("expected list, got {:?}", b[0].payload),
}
}
#[test]
fn probe_empty_heading() {
let (b, _) = parse_blocks(b"# \n# Real\nbody\n", 0).unwrap();
let para = b
.iter()
.find(|x| matches!(x.payload, ParsedPayload::Paragraph { .. }))
.expect("paragraph present");
assert_eq!(para.heading_path, vec!["Real".to_string()]);
}
}