Skip to content

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

feat: warn when a linter test has the same text for the error and the fix (#4433)

Andrew Dunbar2cb9598b64f6
diff --git a/harper-core/src/linting/mod.rs b/harper-core/src/linting/mod.rs
index 31449d708..899e9f1f4 100644
--- a/harper-core/src/linting/mod.rs
+++ b/harper-core/src/linting/mod.rs
@@ -758,6 +758,11 @@ pub mod tests {
// Check if we've reached the expected result
if text == needle {
+ // When tests are made via cut & paste it's easy to miss editing some of the corrections
+ // and the test will silently pass
+ if depth == 0 {
+ eprintln!("⚠️ Input and expected are both '{needle}' - is the test correct?");
+ }
return true;
}