Skip to content

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

chore: convert commented out tests to use `#[ignore]` (#1199)

Andrew Dunbarffc9cbd796b0
diff --git a/harper-core/src/lexing/mod.rs b/harper-core/src/lexing/mod.rs
index b14b545e1..0ff647032 100644
--- a/harper-core/src/lexing/mod.rs
+++ b/harper-core/src/lexing/mod.rs
@@ -358,29 +358,29 @@ mod tests {
));
}
- // #[test]
- // fn lexes_negative_1() {
- // let source: Vec<_> = "-1".chars().collect();
- // assert!(matches!(
- // lex_number(&source),
- // Some(FoundToken {
- // token: TokenKind::Number(_),
- // ..
- // })
- // ));
- // }
-
- // #[test]
- // fn lexes_positive_1() {
- // let source: Vec<_> = "+1".chars().collect();
- // assert!(matches!(
- // lex_number(&source),
- // Some(FoundToken {
- // token: TokenKind::Number(_),
- // ..
- // })
- // ));
- // }
+ #[ignore = "Negative numbers are not yet supported"]
+ fn lexes_negative_1() {
+ let source: Vec<_> = "-1".chars().collect();
+ assert!(matches!(
+ lex_number(&source),
+ Some(FoundToken {
+ token: TokenKind::Number(_),
+ ..
+ })
+ ));
+ }
+
+ #[ignore = "Positive numbers with a leading + are not supported"]
+ fn lexes_positive_1() {
+ let source: Vec<_> = "+1".chars().collect();
+ assert!(matches!(
+ lex_number(&source),
+ Some(FoundToken {
+ token: TokenKind::Number(_),
+ ..
+ })
+ ));
+ }
#[test]
fn lexes_pi() {
diff --git a/harper-core/src/linting/inflected_verb_after_to.rs b/harper-core/src/linting/inflected_verb_after_to.rs
index 51487966d..4a1064650 100644
--- a/harper-core/src/linting/inflected_verb_after_to.rs
+++ b/harper-core/src/linting/inflected_verb_after_to.rs
@@ -165,11 +165,15 @@ mod tests {
);
}
- // -ing forms can act as nouns, current heuristics cannot distinguish
- // #[test]
- // fn flag_to_checking() {
- // assert_lint_count("to checking", InflectedVerbAfterTo::new(FstDictionary::curated(), Dialect::American), 1);
- // }
+ #[test]
+ #[ignore = "-ing forms can act as nouns, current heuristics cannot distinguish"]
+ fn flag_to_checking() {
+ assert_lint_count(
+ "to checking",
+ InflectedVerbAfterTo::new(FstDictionary::curated(), Dialect::American),
+ 1,
+ );
+ }
#[test]
fn dont_flag_check_ed() {
@@ -198,15 +202,15 @@ mod tests {
);
}
- // can't check yet. 'capture' is noun as well as verb. "to nouns" is good English. we can't disambiguate verbs from nouns.
- // #[test]
- // fn check_993_suggestions() {
- // assert_suggestion_result(
- // "A location-agnostic structure that attempts to captures the context and content that a Lint occurred.",
- // InflectedVerbAfterTo::new(FstDictionary::curated(), Dialect::American),
- // "A location-agnostic structure that attempts to capture the context and content that a Lint occurred.",
- // );
- // }
+ #[test]
+ #[ignore = "can't check yet. 'capture' is noun as well as verb. \"to nouns\" is good English. we can't disambiguate verbs from nouns."]
+ fn check_993_suggestions() {
+ assert_suggestion_result(
+ "A location-agnostic structure that attempts to captures the context and content that a Lint occurred.",
+ InflectedVerbAfterTo::new(FstDictionary::curated(), Dialect::American),
+ "A location-agnostic structure that attempts to capture the context and content that a Lint occurred.",
+ );
+ }
#[test]
fn dont_flag_embarrass_not_in_dictionary() {
@@ -226,15 +230,15 @@ mod tests {
);
}
- // can't check yet. 'catch' is noun as well as verb. "to nouns" is good English. we can't disambiguate verbs from nouns.
- // #[test]
- // fn corrects_es_ending() {
- // assert_suggestion_result(
- // "I need it to catches every exception.",
- // InflectedVerbAfterTo::new(FstDictionary::curated(), Dialect::American),
- // "I need it to catch every exception.",
- // );
- // }
+ #[test]
+ #[ignore = "can't check yet. 'catch' is noun as well as verb. 'to nouns' is good English. we can't disambiguate verbs from nouns."]
+ fn corrects_es_ending() {
+ assert_suggestion_result(
+ "I need it to catches every exception.",
+ InflectedVerbAfterTo::new(FstDictionary::curated(), Dialect::American),
+ "I need it to catch every exception.",
+ );
+ }
#[test]
fn corrects_ed_ending() {
@@ -263,15 +267,15 @@ mod tests {
);
}
- // can't check yet. surprisingly, 'explore' is noun as well as verb. "to nouns" is good English. we can't disambiguate verbs from nouns.
- // #[test]
- // fn corrects_explor_ed() {
- // assert_suggestion_result(
- // "I went to explored distant galaxies.",
- // InflectedVerbAfterTo::new(FstDictionary::curated(), Dialect::American),
- // "I went to explore distant galaxies.",
- // );
- // }
+ #[test]
+ #[ignore = "can't check yet. surprisingly, 'explore' is noun as well as verb. 'to nouns' is good English. we can't disambiguate verbs from nouns."]
+ fn corrects_explor_ed() {
+ assert_suggestion_result(
+ "I went to explored distant galaxies.",
+ InflectedVerbAfterTo::new(FstDictionary::curated(), Dialect::American),
+ "I went to explore distant galaxies.",
+ );
+ }
#[test]
fn cant_flag_express_ed_also_noun() {
diff --git a/harper-core/src/linting/it_is.rs b/harper-core/src/linting/it_is.rs
index 9c29cf56c..1e7328113 100644
--- a/harper-core/src/linting/it_is.rs
+++ b/harper-core/src/linting/it_is.rs
@@ -120,15 +120,15 @@ mod tests {
assert_lint_count("Its team lead is excellent.", ItIs::default(), 0);
}
- // This case fails, but I think that's acceptable.
- // #[test]
- // fn does_not_flag_non_adjective() {
- // assert_lint_count(
- // "The cat chased its tail around the room.",
- // ItIs::default(),
- // 0,
- // );
- // }
+ #[test]
+ #[ignore = "This case fails, but I think that's acceptable"]
+ fn does_not_flag_non_adjective() {
+ assert_lint_count(
+ "The cat chased its tail around the room.",
+ ItIs::default(),
+ 0,
+ );
+ }
#[test]
fn does_not_flag_already_correct() {
diff --git a/harper-core/src/linting/lets_confusion/mod.rs b/harper-core/src/linting/lets_confusion/mod.rs
index ca6e31ae4..5b837894d 100644
--- a/harper-core/src/linting/lets_confusion/mod.rs
+++ b/harper-core/src/linting/lets_confusion/mod.rs
@@ -46,24 +46,25 @@ mod tests {
);
}
- // "play" is also a noun so in a context like "Sometimes the umpire lets play continue"
- // #[test]
- // fn issue_470_missing_apostrophe() {
- // assert_suggestion_result("lets play", LetsConfusion::default(), "let's play");
- // }
+ #[test]
+ #[ignore = "\"play\" is also a noun so in a context like \"Sometimes the umpire lets play continue\""]
+ fn issue_470_missing_apostrophe_play() {
+ assert_suggestion_result("lets play", LetsConfusion::default(), "let's play");
+ }
- // #[test]
- // fn issue_470_missing_subject() {
- // assert_suggestion_result("let play", LetsConfusion::default(), "let's play");
- // }
+ #[test]
+ #[ignore]
+ fn issue_470_missing_subject_play() {
+ assert_suggestion_result("let play", LetsConfusion::default(), "let's play");
+ }
#[test]
- fn issue_470_missing_apostrophe() {
+ fn issue_470_missing_apostrophe_proceed() {
assert_suggestion_result("lets proceed", LetsConfusion::default(), "let's proceed");
}
#[test]
- fn issue_470_missing_subject() {
+ fn issue_470_missing_subject_proceed() {
assert_suggestion_result("let proceed", LetsConfusion::default(), "let's proceed");
}
diff --git a/harper-core/src/linting/phrasal_verb_as_compound_noun.rs b/harper-core/src/linting/phrasal_verb_as_compound_noun.rs
index f550d29c4..5ba4e7b6e 100644
--- a/harper-core/src/linting/phrasal_verb_as_compound_noun.rs
+++ b/harper-core/src/linting/phrasal_verb_as_compound_noun.rs
@@ -335,16 +335,15 @@ mod tests {
);
}
- // "Shakedown" is a compound noun -- it's part of a comma-separated list with another noun "threat"
- // But this is not easy to check for so is not implemented yet.
- // #[test]
- // fn dont_flag_a_threat_or_shakedown() {
- // assert_lint_count(
- // "Just a threat or Shakedown.",
- // PhrasalVerbAsCompoundNoun::default(),
- // 0,
- // );
- // }
+ #[test]
+ #[ignore = "\"Shakedown\" is a compound noun -- it's part of a comma-separated list with another noun \"threat\"\nBut this is not easy to check for so is not implemented yet."]
+ fn dont_flag_a_threat_or_shakedown() {
+ assert_lint_count(
+ "Just a threat or Shakedown.",
+ PhrasalVerbAsCompoundNoun::default(),
+ 0,
+ );
+ }
#[test]
fn dont_flag_a_flyover() {
diff --git a/harper-core/src/linting/sentence_capitalization.rs b/harper-core/src/linting/sentence_capitalization.rs
index 96cbb8055..d76c996de 100644
--- a/harper-core/src/linting/sentence_capitalization.rs
+++ b/harper-core/src/linting/sentence_capitalization.rs
@@ -214,15 +214,15 @@ mod tests {
)
}
- // TODO: This can't work because currently hyphens are not included in tokenized words
- // TODO: although they are now permitted in `dictionary.dict`
- // #[test]
- // fn uppercase_unamerican_at_start() {
- // assert_lint_count("un-American starts with a lowercase letter and contains an uppercase letter, but is not a proper noun or trademark.",
- // SentenceCapitalization::new(FstDictionary::curated(), Dialect::American),
- // 1,
- // )
- // }
+ #[test]
+ #[ignore = "This can't work because currently hyphens are not included in tokenized words\nalthough they are now permitted in `dictionary.dict`"]
+ fn uppercase_unamerican_at_start() {
+ assert_lint_count(
+ "un-American starts with a lowercase letter and contains an uppercase letter, but is not a proper noun or trademark.",
+ SentenceCapitalization::new(FstDictionary::curated(), Dialect::American),
+ 1,
+ )
+ }
#[test]
fn allow_lowercase_proper_nouns() {
diff --git a/harper-core/src/linting/spell_check.rs b/harper-core/src/linting/spell_check.rs
index e76206af4..0c869b315 100644
--- a/harper-core/src/linting/spell_check.rs
+++ b/harper-core/src/linting/spell_check.rs
@@ -268,14 +268,15 @@ mod tests {
);
}
- // #[test]
- // fn australian_labour_vs_labor() {
- // assert_lint_count(
- // "In Australia we write 'labour' but the political party is the 'Labor Party'.",
- // SpellCheck::new(FstDictionary::curated(), Dialect::Australian),
- // 0,
- // )
- // }
+ #[test]
+ #[ignore = "This test is broken due to the metadata dialect field not being a collection"]
+ fn australian_labour_vs_labor() {
+ assert_lint_count(
+ "In Australia we write 'labour' but the political party is the 'Labor Party'.",
+ SpellCheck::new(FstDictionary::curated(), Dialect::Australian),
+ 0,
+ )
+ }
#[test]
fn australian_words_flagged_for_american_english() {
diff --git a/harper-core/src/spell/mutable_dictionary.rs b/harper-core/src/spell/mutable_dictionary.rs
index bbdcf514b..32c0a23df 100644
--- a/harper-core/src/spell/mutable_dictionary.rs
+++ b/harper-core/src/spell/mutable_dictionary.rs
@@ -270,6 +270,7 @@ mod tests {
// TODO "this" is a determiner when used similarly to "the"
// TODO but when used alone it's a "demonstrative pronoun"
// TODO Harper previously wrongly classified it as a noun
+ // TODO .is_determiner() is not yet implemented
// #[test]
// fn this_is_determiner() {
// let dict = MutableDictionary::curated();