Skip to content

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

tests(#230): add document with spelling mistakes in different contexts

Grant Lemons122436f04d10
diff --git a/harper-core/tests/run_tests.rs b/harper-core/tests/run_tests.rs
index eb4f21c55..6a8dabc13 100644
--- a/harper-core/tests/run_tests.rs
+++ b/harper-core/tests/run_tests.rs
@@ -53,3 +53,4 @@ create_test!(chinese_lorem_ipsum.md, 2);
create_test!(obsidian_links.md, 2);
create_test!(issue_267.md, 0);
create_test!(complex_typst.typ, 0);
+create_test!(typst_spelling_mistakes.typ, 4);
diff --git a/harper-core/tests/test_sources/complex_typst.typ b/harper-core/tests/test_sources/complex_typst.typ
index 480595be0..42aa16b17 100644
--- a/harper-core/tests/test_sources/complex_typst.typ
+++ b/harper-core/tests/test_sources/complex_typst.typ
@@ -31,9 +31,8 @@
#let count = authors.len()
#let authors_slice = authors.slice(0, calc.min(count, 3))
_#if count > 3 {
- // Disabled because et al. isn't parsed properly, but this isn't the
- // fault of the typst parser
- //
+ // et al. isn't parsed properly, but this isn't the fault of the typst
+ // parser
// authors_slice.push("et al.")
authors_slice.join(", ")
} else {
diff --git a/harper-core/tests/test_sources/typst_spelling_mistakes.typ b/harper-core/tests/test_sources/typst_spelling_mistakes.typ
new file mode 100644
index 000000000..0c82635c3
--- /dev/null
+++ b/harper-core/tests/test_sources/typst_spelling_mistakes.typ
@@ -0,0 +1,63 @@
+#set page(
+ paper: "us-letter",
+ columns: 2,
+)
+
+#let titleblock(
+ title: "Defalt Title",
+ authors: ("Author 1", "Author 2"),
+ abstract: [*This is contnt*],
+) = {
+ set page(
+ header: context {
+ if counter(page).get().first() > 1 [
+ #counter(page).get().first() of #counter(page).final().at(0)
+ #h(1fr)
+ #title
+ ]
+ },
+ )
+ place(
+ top + center,
+ float: true,
+ scope: "parent",
+ clearance: 2em,
+ )[
+ #align(center, text(17pt)[
+ *#title*
+ ])
+
+ #let authors = authors.filter(x => x.len() > 0)
+ #let count = authors.len()
+ #let authors_slice = authors.slice(0, calc.min(count, 3))
+ _#if count > 3 {
+ // et al. isn't parsed properly, but this isn't the fault of the typst
+ // parser
+ // authors_slice.push("et al.")
+ authors_slice.join(", ")
+ } else {
+ authors_slice.join(", ", last: ", and ")
+ }
+ _
+
+ #par(justify: false)[
+ *Abstract* \
+ #abstract
+ ]
+ ]
+}
+
+#show: doc => [
+ #titleblock(
+ title: "A fluid dynamic model for glaier flow",
+ authors: ("Grant Lemons", "John Doe", "Jane Doe"),
+ abstract: lorem(80)
+ )
+ #doc
+]
+
+= Introduction
+#lorem(300)
+
+= Related ork
+#lorem(200)