Skip to content

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

fix: debug/todo cleanup; better test

hippietrail2a2f2d8a60ee
diff --git a/harper-core/src/linting/phrase_corrections.rs b/harper-core/src/linting/phrase_corrections.rs
index 09f45b8db..b3ccfe736 100644
--- a/harper-core/src/linting/phrase_corrections.rs
+++ b/harper-core/src/linting/phrase_corrections.rs
@@ -1135,29 +1135,6 @@ mod tests {
assert_suggestion_result("a whole entire", lint_group(), "a whole");
}
- #[test]
- fn correct_a_whole_entire_surrounded_by_text() {
- assert_suggestion_result(
- "A B C D a whole entire W X Y Z",
- lint_group(),
- "A B C D a whole W X Y Z",
- );
- }
-
- #[test]
- fn correct_a_whole_entire_surrounded_by_numbers() {
- assert_suggestion_result(
- "0123456789 a whole entire 9876543210",
- lint_group(),
- "0123456789 a whole 9876543210",
- );
- }
-
- #[test]
- fn correct_a_whole_entire_other() {
- assert_suggestion_result("a whole entire other", lint_group(), "a whole other");
- }
-
#[test]
fn correct_atomic_a_whole_entire_to_an_entire() {
assert_nth_suggestion_result("a whole entire", lint_group(), "an entire", 1);
@@ -1172,10 +1149,8 @@ mod tests {
);
}
- // TODO: something goes wrong when both WholeEntire and AWholeEntire are enabled
- // TODO: result is `Start mapping a wholeanet using NASA’s MOLA.`
#[test]
- fn correct_real_world_a_whole_entire() {
+ fn correct_real_world_a_whole_entire_to_a_whole() {
assert_suggestion_result(
"Start mapping a whole entire new planet using NASA’s MOLA.",
lint_group(),
@@ -1183,6 +1158,16 @@ mod tests {
);
}
+ #[test]
+ fn correct_real_world_a_whole_entire_to_an_entire() {
+ assert_nth_suggestion_result(
+ "I am not sure I can pass in a whole entire query via the include.",
+ lint_group(),
+ "I am not sure I can pass in an entire query via the include.",
+ 1,
+ );
+ }
+
fn in_detail_atomic() {
assert_suggestion_result("in details", lint_group(), "in detail");
}
diff --git a/harper-core/src/linting/suggestion.rs b/harper-core/src/linting/suggestion.rs
index 115a8f5a1..0941ebb67 100644
--- a/harper-core/src/linting/suggestion.rs
+++ b/harper-core/src/linting/suggestion.rs
@@ -47,12 +47,10 @@ impl Suggestion {
Self::ReplaceWith(chars) => {
// Avoid allocation if possible
if chars.len() == span.len() {
- println!("char len = span.len");
for (index, c) in chars.iter().enumerate() {
source[index + span.start] = *c
}
} else {
- println!("char len ≠ span.len");
let popped = source.split_off(span.start);
source.extend(chars);