Skip to content

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

feat(core): make `WasAloud` more general

Elijah Pottercfc793317b0f
diff --git a/harper-core/src/linting/was_aloud.rs b/harper-core/src/linting/was_aloud.rs
index 6bdb4076f..9fc66afe7 100644
--- a/harper-core/src/linting/was_aloud.rs
+++ b/harper-core/src/linting/was_aloud.rs
@@ -11,7 +11,7 @@ pub struct WasAloud {
impl Default for WasAloud {
fn default() -> Self {
let pattern = SequencePattern::default()
- .then_word_set(WordSet::all(&["was", "were"]))
+ .then_word_set(WordSet::all(&["was", "were", "be", "been"]))
.then_whitespace()
.then_exact_word("aloud");
@@ -86,4 +86,22 @@ mod tests {
"The concert was loud and exciting.",
);
}
+
+ #[test]
+ fn be_aloud() {
+ assert_suggestion_result(
+ "You may be aloud to enter the room.",
+ WasAloud::default(),
+ "You may be allowed to enter the room.",
+ );
+ }
+
+ #[test]
+ fn been_aloud() {
+ assert_suggestion_result(
+ "If I had been aloud to enter I would've jumped at the chance.",
+ WasAloud::default(),
+ "If I had been allowed to enter I would've jumped at the chance.",
+ );
+ }
}