Inline input files inside project classes and packages
This commit is contained in:
1 parent
cca108dc15
commit
04446e673f
5 files changed
+101
-4
No files matched your search
@@ -450,6 +450,46 @@ fn project_preview_executes_local_package_options() {
|
||||
assert!(!text.contains(">Q</text>"), "{text}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_classes_expand_input_files() {
|
||||
let server = TestServer::start("route-d-class-input");
|
||||
for (path, source) in [
|
||||
("layout.tex", "\\newcommand{\\layoutword}{QK}\n"),
|
||||
(
|
||||
"myclass.cls",
|
||||
"\\ProvidesClass{myclass}\n\\input{layout}\n\\input{missing-file}\n\\newcommand{\\classword}{VW}\n",
|
||||
),
|
||||
(
|
||||
"hello.tex",
|
||||
"\\documentclass{myclass}\n\\begin{document}\nBody \\layoutword{} \\classword.\n\\end{document}\n",
|
||||
),
|
||||
] {
|
||||
let response = server.request(
|
||||
"PUT",
|
||||
&format!("/api/projects/hello/file?path={path}"),
|
||||
source.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 ["Q", "K", "V", "W"] {
|
||||
assert!(
|
||||
text.contains(&format!(">{character}</text>")),
|
||||
"missing {character}: {text}"
|
||||
);
|
||||
}
|
||||
assert!(!text.contains("ProvidesClass"), "{text}");
|
||||
assert!(!text.contains("missing-file"), "{text}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_preview_loads_local_base_classes() {
|
||||
let server = TestServer::start("route-d-base-class");
|
||||
|
||||
Reference in new issue
Block a user