Run package document hooks and strip makeat
This commit is contained in:
1 parent
e3e230042a
commit
3723036710
5 files changed
+105
-6
No files matched your search
@@ -546,6 +546,43 @@ fn project_preview_loads_local_base_classes() {
|
||||
assert!(!text.contains("LoadClass"), "{text}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_packages_run_begin_document_hooks() {
|
||||
let server = TestServer::start("route-d-package-hooks");
|
||||
let style = "\\ProvidesPackage{mystyle}\n\\makeatletter\n\\AtBeginDocument{\\newcommand{\\hookword}{BQ}}\n\\makeatother\n\\newcommand{\\plainword}{JK}\n";
|
||||
let response = server.request(
|
||||
"PUT",
|
||||
"/api/projects/hello/file?path=mystyle.sty",
|
||||
style.as_bytes(),
|
||||
"text/plain; charset=utf-8",
|
||||
);
|
||||
assert_eq!(response.status, 200, "{}", response.text());
|
||||
let document = "\\documentclass{article}\n\\usepackage{mystyle}\n\\begin{document}\nBody \\plainword{} \\hookword.\n\\end{document}\n";
|
||||
let response = server.request(
|
||||
"PUT",
|
||||
"/api/projects/hello/file?path=hello.tex",
|
||||
document.as_bytes(),
|
||||
"text/plain; charset=utf-8",
|
||||
);
|
||||
assert_eq!(response.status, 200, "{}", response.text());
|
||||
let preview = server.request(
|
||||
"POST",
|
||||
"/api/projects/hello/preview?engine=route-d",
|
||||
&[],
|
||||
"application/json",
|
||||
);
|
||||
assert_eq!(preview.status, 200, "{}", preview.text());
|
||||
let text = preview.text();
|
||||
for character in ["B", "Q", "J", "K"] {
|
||||
assert!(
|
||||
text.contains(&format!(">{character}</text>")),
|
||||
"missing {character}: {text}"
|
||||
);
|
||||
}
|
||||
assert!(!text.contains("AtBeginDocument"), "{text}");
|
||||
assert!(!text.contains("makeatletter"), "{text}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_previews_apply_passed_package_and_class_options() {
|
||||
let server = TestServer::start("route-d-passed-options");
|
||||
|
||||
Reference in new issue
Block a user