Print DVI dictionary warnings on their own TeX lines

This commit is contained in:
gloamxun committed 2026-11-21 06:03:17 +08:00
1 parent 1822ab2d32
commit 3ed2c2cd54
3 files changed
+75 -2

No files matched your search

+59
View File
@@ -276,3 +276,62 @@ fn byte_pdf_profile_uses_real_absolute_comparisons_and_device_options() {
}
fs::remove_dir_all(dir).unwrap();
}
#[test]
fn dvi_dictionary_warnings_keep_their_own_wrapped_lines() {
let root = directory();
let oracle = directory();
let source = r"\catcode123=1 \catcode125=2
\pdfoutput=0
\message{BEFORE-INFO}
\pdfinfo{/Title (ignored)}
\immediate\write16{AFTER-INFO}
\pdfcatalog{/Lang (en)}
\message{AFTER-CATALOG}
\end";
for path in [&root, &oracle] {
fs::write(path.join("probe.tex"), source).unwrap();
}
let actual = native_fonts::command()
.current_dir(&root)
.env("TEXRRA_STATE_DIR", root.join("state"))
.args([
"native",
"--job",
"--initex",
"--etex",
"probe.tex",
"native.pdf",
])
.output()
.unwrap();
let expected = Command::new("pdftex")
.current_dir(&oracle)
.args([
"-ini",
"-etex",
"-interaction=nonstopmode",
"-halt-on-error",
"probe.tex",
])
.output()
.unwrap();
assert!(actual.status.success(), "{actual:?}");
assert!(expected.status.success(), "{expected:?}");
let between_messages = |bytes: &[u8]| {
let text = std::str::from_utf8(bytes).unwrap();
let start = text.find("BEFORE-INFO").unwrap();
let end = text.find("AFTER-CATALOG").unwrap();
text[start..end].to_owned()
};
assert_eq!(
between_messages(&actual.stderr),
between_messages(&expected.stdout)
);
assert_eq!(
between_messages(&fs::read(root.join("native.log")).unwrap()),
between_messages(&fs::read(oracle.join("probe.log")).unwrap())
);
fs::remove_dir_all(root).unwrap();
fs::remove_dir_all(oracle).unwrap();
}