use cpp_parser::{CppParser, ParserConfig};
#[allow(dead_code)]
pub fn assert_all_parse(standard: &str, constructs: &[(&str, &str)]) {
let mut failed: Vec<(&str, String)> = Vec::new();
for (name, source) in constructs {
let tree = CppParser::parse(source, ParserConfig::default());
let errors = tree.get_errors();
if !errors.is_empty() {
failed.push((name, format!("{errors:?}")));
}
}
assert!(
failed.is_empty(),
"{standard}: {} of {} construct(s) do not parse:\n{}",
failed.len(),
constructs.len(),
failed
.iter()
.map(|(name, errors)| format!(" {name}: {errors}"))
.collect::<Vec<_>>()
.join("\n")
);
}