Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(core): repair commented-out test
Elijah Potter58d62da96b01
diff --git a/harper-core/affixes.json b/harper-core/affixes.jsonindex 720618301..70fb5e5b8 100644--- a/harper-core/affixes.json+++ b/harper-core/affixes.json@@ -714,6 +714,31 @@"gifts_metadata": {"adjective": {}}+ },+ "*": {+ "#": "singular third-person pronoun property",+ "suffix": true,+ "cross_product": true,+ "replacements": [],+ "adds_metadata": {},+ "gifts_metadata": {+ "pronoun": {+ "is_plural": false,+ "person": "Third"+ }+ }+ },+ ":": {+ "#": "plural pronoun property",+ "suffix": true,+ "cross_product": true,+ "replacements": [],+ "adds_metadata": {},+ "gifts_metadata": {+ "pronoun": {+ "is_plural": true+ }+ }}}}diff --git a/harper-core/dictionary.dict b/harper-core/dictionary.dictindex b45dee42b..40a26589d 100644--- a/harper-core/dictionary.dict+++ b/harper-core/dictionary.dict@@ -26401,7 +26401,7 @@ hazing/14Mhazmat/1hazy/51RTPhdqrs/1-he/8~st+he/*~sthe'd/he'll/he's/@@ -29024,7 +29024,7 @@ issue/14ADSMGissuer/1MSisthmian/51isthmus/1MS-it/8~sot+it/*~sotit'd/it'll/it's/@@ -41583,7 +41583,7 @@ shaver/1Mshaving/14Mshawl/14MSshay/1MS-she/8~st+she/*~stshe'd/she'll/she's/@@ -45590,7 +45590,7 @@ thesis/1Mthespian/51SMtheta/1SMthew/14MS-they/8~st+they/:~stthey'd/they'll/they're/@@ -48556,7 +48556,7 @@ wayside/15SMwayward/5PYwaywardness/1Mwazoo/1S-we/8~sf+we/~sf:we'd/we'll/we're/@@ -49523,7 +49523,7 @@ yon/8yonder/51yonks/1yore/1M-you/8~son+you/:~sonyou'd/you'll/you're/diff --git a/harper-core/src/linting/plural_conjugate.rs b/harper-core/src/linting/plural_conjugate.rsindex a37aaea2c..d892c7b0f 100644--- a/harper-core/src/linting/plural_conjugate.rs+++ b/harper-core/src/linting/plural_conjugate.rs@@ -1,6 +1,6 @@use crate::{Token,- patterns::{EitherPattern, Pattern, SequencePattern},+ patterns::{OwnedPatternExt, Pattern, SequencePattern},};use super::{Lint, LintKind, PatternLinter, Suggestion};@@ -23,7 +23,7 @@ impl Default for PluralConjugate {.then_whitespace().then_exact_word("are");- let pat = EitherPattern::new(vec![Box::new(plural_case), Box::new(non_plural_case)]);+ let pat = plural_case.or(Box::new(non_plural_case));Self {pattern: Box::new(pat),@@ -101,14 +101,75 @@ mod tests {);}- // TODO disabled since it relied on the /1 affix flag which meant noun as well as singular- // TODO currently there is no way to mark number on pronouns without making them also nouns- // #[test]- // fn pronoun_singular() {- // assert_suggestion_result(- // "If he are testing it.",- // PluralConjugate::default(),- // "If he is testing it.",- // );- // }+ #[test]+ fn pronoun_singular_he_test() {+ assert_suggestion_result(+ "If he are testing it.",+ PluralConjugate::default(),+ "If he is testing it.",+ );+ }++ #[test]+ fn pronoun_singular_he_going() {+ assert_suggestion_result(+ "He are going to the store.",+ PluralConjugate::default(),+ "He is going to the store.",+ );+ }++ #[test]+ fn pronoun_singular_she() {+ assert_suggestion_result(+ "She are playing soccer.",+ PluralConjugate::default(),+ "She is playing soccer.",+ );+ }++ #[test]+ fn pronoun_singular_it() {+ assert_suggestion_result(+ "It are on the table.",+ PluralConjugate::default(),+ "It is on the table.",+ );+ }++ #[test]+ fn pronoun_plural_they() {+ assert_suggestion_result(+ "They is arriving soon.",+ PluralConjugate::default(),+ "They are arriving soon.",+ );+ }++ #[test]+ fn pronoun_plural_we() {+ assert_suggestion_result(+ "We is having lunch now.",+ PluralConjugate::default(),+ "We are having lunch now.",+ );+ }++ #[test]+ fn pronoun_plural_you() {+ assert_suggestion_result(+ "You is responsible for this task.",+ PluralConjugate::default(),+ "You are responsible for this task.",+ );+ }++ #[test]+ fn collective_noun_singular() {+ assert_suggestion_result(+ "The committee are meeting today.",+ PluralConjugate::default(),+ "The committee is meeting today.",+ );+ }}diff --git a/harper-core/src/spell/hunspell/expansion.rs b/harper-core/src/spell/hunspell/expansion.rsindex 8c75cb26b..9de030e6e 100644--- a/harper-core/src/spell/hunspell/expansion.rs+++ b/harper-core/src/spell/hunspell/expansion.rs@@ -6,8 +6,6 @@ use crate::WordMetadata;#[derive(Debug, Clone)]pub struct Expansion {- // TODO some attributes only signify a property and neither a prefix nor a suffix- // TODO currently those have the "suffix" field set to true/// If `!true`, this is a prefixpub suffix: bool,pub cross_product: bool,diff --git a/harper-core/src/word_metadata.rs b/harper-core/src/word_metadata.rsindex 1c279e994..246de209a 100644--- a/harper-core/src/word_metadata.rs+++ b/harper-core/src/word_metadata.rs@@ -112,7 +112,7 @@ impl WordMetadata {adverb has);- /// Checks if the word is definitely a nominal.+ /// Checks if the word is definitely a nominalpro.pub fn is_nominal(&self) -> bool {self.noun.is_some() || self.pronoun.is_some()}@@ -230,7 +230,7 @@ impl VerbData {// TODO renamed from "noun" until refactoring is complete// TODO other noun properties may be worth adding:-// TODO count vs mass; abstract+// TODO count vs mass; abstract#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, PartialOrd, Eq, Hash, Default)]pub struct NounData {pub is_proper: Option<bool>,@@ -249,7 +249,7 @@ impl NounData {}}-// person is a property of pronouns; the verb 'be', plus all verbs reflect 3rd person singular with -s+// Person is a property of pronouns; the verb 'be', plus all verbs reflect 3rd person singular with -s#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, PartialOrd, Is, Hash)]pub enum Person {First,@@ -285,9 +285,9 @@ impl PronounData {}}-// degree is a property of adjectives: positive is not inflected-// comparative is inflected with -er or comes after the word "more"-// superlative is inflected with -est or comes after the word "most"+// Degree is a property of adjectives: positive is not inflected+// Comparative is inflected with -er or comes after the word "more"+// Superlative is inflected with -est or comes after the word "most"#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, PartialOrd, Is, Hash)]pub enum Degree {Positive,