Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

tests: rename typst tests and add simplified document

Grant Lemons7cb7b25fd79f
diff --git a/harper-typst/tests/run_tests.rs b/harper-typst/tests/run_tests.rs
index c9c15f73e..a9acc4df4 100644
--- a/harper-typst/tests/run_tests.rs
+++ b/harper-typst/tests/run_tests.rs
@@ -37,5 +37,6 @@ macro_rules! create_test {
};
}
-create_test!(complex_typst.typ, 0);
-create_test!(typst_spelling_mistakes.typ, 4);
+create_test!(complex_document.typ, 0);
+create_test!(simplified_document.typ, 0);
+create_test!(complex_with_spelling_mistakes.typ, 4);
diff --git a/harper-typst/tests/test_sources/complex_typst.typ b/harper-typst/tests/test_sources/complex_document.typ
similarity index 100%
rename from harper-typst/tests/test_sources/complex_typst.typ
rename to harper-typst/tests/test_sources/complex_document.typ
diff --git a/harper-typst/tests/test_sources/typst_spelling_mistakes.typ b/harper-typst/tests/test_sources/complex_with_spelling_mistakes.typ
similarity index 100%
rename from harper-typst/tests/test_sources/typst_spelling_mistakes.typ
rename to harper-typst/tests/test_sources/complex_with_spelling_mistakes.typ
diff --git a/harper-typst/tests/test_sources/simplified_document.typ b/harper-typst/tests/test_sources/simplified_document.typ
new file mode 100644
index 000000000..cd22f9be2
--- /dev/null
+++ b/harper-typst/tests/test_sources/simplified_document.typ
@@ -0,0 +1,55 @@
+#let template(
+ title: "Default Title",
+ authors: ("Author 1", "Author 2"),
+ abstract: [*This is content*],
+ body,
+) = {
+ set par(justify: true)
+ set page(
+ paper: "us-letter",
+ columns: 2,
+ number-align: top,
+ numbering: (..n) => if n.pos().first() > 1 {
+ n.pos().map(str).join(" of ") + h(1fr) + title
+ },
+ )
+
+ place(
+ top + center,
+ float: true,
+ scope: "parent",
+ clearance: 2em,
+ )[
+ #show heading: set text(17pt)
+ = #title
+
+ #let authors-line = if authors.len() > 3 {
+ // "et al." isn't parsed properly, but this isn't the fault of the Typst
+ // parser.
+ // authors-max3.push("et al.")
+ authors => authors.join(", ")
+ } else {
+ authors => authors.join(", ", last: ", and ")
+ }
+ #emph(authors-line(authors.slice(0, calc.min(authors.len(), 3))))
+
+ #par(justify: false)[
+ *Abstract* \
+ #abstract
+ ]
+ ]
+
+ body
+}
+
+#show: template.with(
+ title: "A fluid dynamic model for glacier flow",
+ authors: ("Grant Lemons", "John Doe", "Jane Doe"),
+ abstract: lorem(80),
+)
+
+= Introduction
+#lorem(300)
+
+= Related Work
+#lorem(200)