Skip to content

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

fix(core): the Oxford comma applies to `nor` as well

Elijah Potter1aeac34848bf
diff --git a/harper-core/src/linting/oxford_comma.rs b/harper-core/src/linting/oxford_comma.rs
index 2e657ce73..485b2051e 100644
--- a/harper-core/src/linting/oxford_comma.rs
+++ b/harper-core/src/linting/oxford_comma.rs
@@ -21,7 +21,7 @@ impl OxfordComma {
))
.then_noun_phrase()
.then_whitespace()
- .then(Box::new(WordSet::all(&["and", "or"])))
+ .then(Box::new(WordSet::all(&["and", "or", "nor"])))
.then_whitespace()
.then_noun_phrase(),
}
@@ -150,4 +150,13 @@ mod tests {
"They enjoy playing soccer, basketball, or tennis.",
);
}
+
+ #[test]
+ fn nor_vegetables() {
+ assert_suggestion_result(
+ "I like carrots, kale nor broccoli.",
+ OxfordComma::default(),
+ "I like carrots, kale, nor broccoli.",
+ );
+ }
}