Skip to content

Commit

Permalink
test(core): add and fix tests from #470
Browse files Browse the repository at this point in the history
  • Loading branch information
elijah-potter committed Jan 22, 2025
1 parent 663f717 commit 374920a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions harper-core/src/linting/lets_confusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,14 @@ mod tests {
fn from_harper_docs() {
assert_suggestion_result("Often the longest and the shortest words are the most helpful, so lets push them first.", LetsConfusion::default(), "Often the longest and the shortest words are the most helpful, so let's push them first.");
}

#[test]
fn issue_470_missing_apostrophe() {
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");
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
linting::{Lint, LintKind, Suggestion},
patterns::{Pattern, SequencePattern},
patterns::{Pattern, SequencePattern, WordSet},
Token,
};

Expand All @@ -12,7 +12,10 @@ pub struct NoContractionWithVerb {

impl Default for NoContractionWithVerb {
fn default() -> Self {
let pattern = SequencePattern::aco("lets").then_whitespace().then_verb();
let pattern = SequencePattern::default()
.then_word_set(WordSet::all(&["lets", "let"]))
.then_whitespace()
.then_verb();

Self {
pattern: Box::new(pattern),
Expand Down

0 comments on commit 374920a

Please sign in to comment.