Reuse command lookup hashes and validate cached meanings by shard

This commit is contained in:
gloamxun committed 2026-11-29 10:52:20 +08:00
1 parent 330c4bde51
commit d249ec7eba
4 files changed
+105 -30

No files matched your search

+30
View File
@@ -63,6 +63,36 @@ fn native_cli_executes_input_macros_registers_and_exports_a_real_pdf() {
fs::remove_dir_all(directory).unwrap();
}
#[test]
fn cached_command_meanings_follow_definitions_and_group_restoration() {
let directory = directory();
fs::write(
directory.join("scoped.tex"),
r"\def\stable{A}\def\globalbinding{G}
\ifdefined\scoped\errmessage{Initially defined}\fi
\message{BEFORE=\stable\globalbinding}
{\def\scoped{B}\def\stable{C}
\ifdefined\scoped\else\errmessage{Local definition lost}\fi
\message{INSIDE=\stable\scoped\globalbinding}
\global\def\globalbinding{H}}
\ifdefined\scoped\errmessage{Local definition leaked}\fi
\message{AFTER=\stable\globalbinding}
\def\scoped{D}\message{DEFINED-AGAIN=\scoped}\end",
)
.unwrap();
let output = native_fonts::command()
.args(["native", "--etex", "scoped.tex", "scoped.pdf"])
.current_dir(&directory)
.output()
.unwrap();
let diagnostics = String::from_utf8_lossy(&output.stderr);
assert!(output.status.success(), "{diagnostics}");
for message in ["BEFORE=AG", "INSIDE=CBG", "AFTER=AH", "DEFINED-AGAIN=D"] {
assert!(diagnostics.contains(message), "{diagnostics}");
}
fs::remove_dir_all(directory).unwrap();
}
#[test]
fn unsupported_native_latex_is_an_error_and_cannot_overwrite_an_existing_pdf() {
let directory = directory();