Inline required local packages recursively
This commit is contained in:
1 parent
64325d4b87
commit
f48b10340a
5 files changed
+121
-25
No files matched your search
@@ -343,6 +343,54 @@ fn project_preview_expands_local_style_packages() {
|
||||
assert!(!text.contains("ProvidesPackage"), "{text}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_preview_expands_required_style_packages() {
|
||||
let server = TestServer::start("route-d-required-package");
|
||||
for (path, body) in [
|
||||
(
|
||||
"base.sty",
|
||||
"\\ProvidesPackage{base}\n\\newcommand{\\base}{J}",
|
||||
),
|
||||
(
|
||||
"helper.sty",
|
||||
"\\ProvidesPackage{helper}\n\\newcommand{\\helper}{K}",
|
||||
),
|
||||
(
|
||||
"mystyle.sty",
|
||||
"\\ProvidesPackage{mystyle}\n\\NeedsTeXFormat{LaTeX2e}\n\\RequirePackage{base}\n\\RequirePackage{helper}\n\\RequirePackage{amsmath}\n\\newcommand{\\greet}{Q}",
|
||||
),
|
||||
] {
|
||||
let put = server.request(
|
||||
"PUT",
|
||||
&format!("/api/projects/hello/file?path={path}"),
|
||||
body.as_bytes(),
|
||||
"text/plain; charset=utf-8",
|
||||
);
|
||||
assert_eq!(put.status, 200, "{}", put.text());
|
||||
}
|
||||
let source = "\\documentclass{article}\n\\usepackage{mystyle}\n\n\\base\\helper\\greet";
|
||||
let put = server.request(
|
||||
"PUT",
|
||||
"/api/projects/hello/file?path=hello.tex",
|
||||
source.as_bytes(),
|
||||
"text/plain; charset=utf-8",
|
||||
);
|
||||
assert_eq!(put.status, 200, "{}", put.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();
|
||||
assert!(text.contains(">J</text>"), "{text}");
|
||||
assert!(text.contains(">K</text>"), "{text}");
|
||||
assert!(text.contains(">Q</text>"), "{text}");
|
||||
assert!(!text.contains("amsmath"), "{text}");
|
||||
assert!(!text.contains("RequirePackage"), "{text}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn project_pdf_expands_included_files() {
|
||||
let server = TestServer::start("route-d-input-pdf");
|
||||
|
||||
Reference in new issue
Block a user