From de61c4cbf966a530f301ed603ce011fb151cf82a Mon Sep 17 00:00:00 2001 From: Andrew Voynov Date: Thu, 16 Jan 2025 03:34:20 +0300 Subject: [PATCH] style: reformatted things a bit; fixed nitpicks --- harper-typst/src/lib.rs | 36 +++++++++---------- .../tests/test_sources/complex_document.typ | 2 +- .../complex_with_spelling_mistakes.typ | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/harper-typst/src/lib.rs b/harper-typst/src/lib.rs index 24836285..9668fc52 100644 --- a/harper-typst/src/lib.rs +++ b/harper-typst/src/lib.rs @@ -99,9 +99,9 @@ mod tests { #[test] fn dict_parsing() { let source = r#"#let dict = ( - name: "Typst", - born: 2019, - )"#; + name: "Typst", + born: 2019, + )"#; let document = Document::new_curated(source, &Typst); let token_kinds = document.tokens().map(|t| t.kind).collect_vec(); @@ -114,11 +114,11 @@ mod tests { assert!(matches!( token_kinds.as_slice(), &[ - TokenKind::Unlintable, // Ident - TokenKind::Unlintable, // Key 1 - TokenKind::Word(_), // Value 1 - TokenKind::Unlintable, // Key 2 - TokenKind::Unlintable, // Value 2 + TokenKind::Unlintable, // dict + TokenKind::Unlintable, // name (key 1) + TokenKind::Word(_), // Typst (value 1) + TokenKind::Unlintable, // born (key 2) + TokenKind::Unlintable, // 2019 (value 2) ] )) } @@ -134,14 +134,14 @@ mod tests { assert!(matches!( &token_kinds.as_slice(), &[ - TokenKind::Unlintable, - TokenKind::Word(_), // This - TokenKind::Space(1), - TokenKind::Word(_), // Is - TokenKind::Space(1), - TokenKind::Word(_), // A - TokenKind::Space(1), - TokenKind::Word(_), // String + TokenKind::Unlintable, // ident + TokenKind::Word(_), // This + TokenKind::Space(1), // + TokenKind::Word(_), // is + TokenKind::Space(1), // + TokenKind::Word(_), // a + TokenKind::Space(1), // + TokenKind::Word(_), // string ] )) } @@ -160,13 +160,13 @@ mod tests { TokenKind::Unlintable, // authors_slice.join TokenKind::Punctuation(Punctuation::Comma), TokenKind::Space(1), - TokenKind::Unlintable, // Ident + TokenKind::Unlintable, // last TokenKind::Punctuation(Punctuation::Comma), TokenKind::Space(1), TokenKind::Word(_), // and TokenKind::Space(1), TokenKind::Space(2), - TokenKind::Word(_), + TokenKind::Word(_), // bob ] )) } diff --git a/harper-typst/tests/test_sources/complex_document.typ b/harper-typst/tests/test_sources/complex_document.typ index 42aa16b1..1a6c65c5 100644 --- a/harper-typst/tests/test_sources/complex_document.typ +++ b/harper-typst/tests/test_sources/complex_document.typ @@ -31,7 +31,7 @@ #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 + // et al. isn't parsed properly, but this isn't the fault of the Typst // parser // authors_slice.push("et al.") authors_slice.join(", ") diff --git a/harper-typst/tests/test_sources/complex_with_spelling_mistakes.typ b/harper-typst/tests/test_sources/complex_with_spelling_mistakes.typ index 0c82635c..6e65b73f 100644 --- a/harper-typst/tests/test_sources/complex_with_spelling_mistakes.typ +++ b/harper-typst/tests/test_sources/complex_with_spelling_mistakes.typ @@ -31,7 +31,7 @@ #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 + // et al. isn't parsed properly, but this isn't the fault of the Typst // parser // authors_slice.push("et al.") authors_slice.join(", ")