Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: as it so happens→as it happens / on route→en route (#1436)
Andrew Dunbarf2b8dce022dd
diff --git a/harper-core/src/linting/phrase_corrections/mod.rs b/harper-core/src/linting/phrase_corrections/mod.rsindex 964fbbec1..7de40443e 100644--- a/harper-core/src/linting/phrase_corrections/mod.rs+++ b/harper-core/src/linting/phrase_corrections/mod.rs@@ -112,6 +112,12 @@ pub fn lint_group() -> LintGroup {"Use `as far back as` for referring to a time in the past.","Corrects nonstandard `as early back as` to `as far back as`."),+ "AsItHappens" => (+ ["as it so happens"],+ ["as it happens"],+ "Did you mean `as it happens`?",+ "Corrects `as it so happens` to `as it happens`."+ ),"AsOfLate" => (["as of lately"],["as of late"],@@ -365,6 +371,12 @@ pub fn lint_group() -> LintGroup {"Did you mean `en masse`?","Detects variants like `on mass` or `in mass` and suggests `en masse`."),+ "EnRoute" => (+ ["on route to", "in route to", "on-route to", "in-route to"],+ ["en route to", "en-route to"],+ "Did you mean `en route`?",+ "Detects variants like `on route` or `in route` and suggests `en route`."+ ),"EverPresent" => (["ever present"],["ever-present"],diff --git a/harper-core/src/linting/phrase_corrections/tests.rs b/harper-core/src/linting/phrase_corrections/tests.rsindex 23e2c5d40..21fbd80b0 100644--- a/harper-core/src/linting/phrase_corrections/tests.rs+++ b/harper-core/src/linting/phrase_corrections/tests.rs@@ -1,5 +1,6 @@use crate::linting::tests::{assert_lint_count, assert_nth_suggestion_result, assert_suggestion_result,+ assert_top3_suggestion_result,};use super::lint_group;@@ -139,6 +140,16 @@ fn detect_as_early_back_as_real_world() {);}+// AsItHappens+#[test]+fn correct_as_it_happens() {+ assert_suggestion_result(+ "As it so happens, we have language currently in review that basically states that a major version break means backwards incompatibility ...",+ lint_group(),+ "As it happens, we have language currently in review that basically states that a major version break means backwards incompatibility ...",+ );+}+// AsOfLate#[test]fn corrects_as_of_lately() {@@ -454,6 +465,44 @@ fn in_mass() {assert_suggestion_result("in mass", lint_group(), "en masse");}+// EnRoute+#[test]+fn on_route() {+ assert_suggestion_result("on route to", lint_group(), "en route to");+}++#[test]+fn in_route() {+ assert_suggestion_result("in route to", lint_group(), "en route to");+}++#[test]+fn on_route_real_world() {+ assert_suggestion_result(+ "vehicles may already be on route to one end of a Shipment",+ lint_group(),+ "vehicles may already be en route to one end of a Shipment",+ );+}++#[test]+fn on_hyphen_route_real_world() {+ assert_top3_suggestion_result(+ "I ultimately just want a slight preference for matches that are on-route to correct cases like the above.",+ lint_group(),+ "I ultimately just want a slight preference for matches that are en-route to correct cases like the above.",+ );+}++#[test]+fn in_route_real_world() {+ assert_suggestion_result(+ "TF-South is in route to conduct SSE on the strike.",+ lint_group(),+ "TF-South is en route to conduct SSE on the strike.",+ );+}+// EverPresent#[test]fn detect_ever_present_atomic() {