Put native PDF warnings on separate diagnostic lines

This commit is contained in:
gloamxun committed 2026-11-21 06:45:35 +08:00
1 parent 75d3667397
commit 3ff339341b
4 files changed
+41 -5

No files matched your search

+30
View File
@@ -181,3 +181,33 @@ fn local_structure_action_references_the_shipped_structure_and_later_page() {
assert_eq!(destination[1].as_name().unwrap(), b"FitR");
fs::remove_dir_all(root).unwrap();
}
#[test]
fn each_export_warning_starts_on_its_own_log_line() {
let root = std::env::temp_dir().join(format!("texrra-pdf-warning-lines-{}", std::process::id()));
let source = r"\catcode123=1 \catcode125=2
\pdfoutput=1 \pdfmajorversion=2 \pdfminorversion=0
\pdfcompresslevel=0 \pdfobjcompresslevel=0
\immediate\pdfobj{<< /Type /StructElem /S /Sect >>}
\count1=\pdflastobj
\shipout\hbox{\pdfdest struct \count1 name{first} xyz
\pdfdest struct \count1 name{first} xyz
\pdfdest struct \count1 name{second} xyz
\pdfdest struct \count1 name{second} xyz
\vrule width4pt height3pt}
\message{LAST-MESSAGE}
\end";
let doc = compile(&root, source, true);
assert_eq!(doc.get_pages().len(), 1);
let transcript = fs::read_to_string(root.join("native/probe.log")).unwrap();
let descriptions: Vec<_> = transcript
.lines()
.filter_map(|line| line.strip_prefix("native PDF warning: "))
.collect();
assert_eq!(descriptions.len(), 2, "{transcript}");
for (description, target) in descriptions.iter().zip(["first", "second"]) {
assert!(description.contains(&format!("name{{{target}}}")));
assert!(description.ends_with("duplicate ignored"));
}
fs::remove_dir_all(root).unwrap();
}