fix(spellcheck): Linux wordlist flags unknown words; only hunspell counts as CLI

- check_word returned "valid" for a word missing from a loaded wordlist
  (!words.is_empty() && !contains, with contains already false), so the
  wordlist backend never flagged anything.
- aspell on PATH counted as a CLI speller, but only hunspell is invoked,
  so on a machine with aspell and no hunspell every CLI check silently
  failed.
- A bare wordlist offers no suggestions; the test no longer demands
  them from the linux_system backend. Unused PathBuf import dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-09-29 23:25:25 +03:00
1 parent 60e23a43a6
commit ab0682153d
2 files changed
+10 -5

No files matched your search

+4 -2
View File
@@ -819,7 +819,9 @@ fn text_audit_system_spellcheck_flags_misspelled_words() {
flagged
);
// At least one flagged word should have suggestions
// At least one flagged word should have suggestions — except from a
// bare Linux wordlist, which can tell a word is unknown but has no
// way to suggest one without the hunspell CLI.
let has_suggestions = words.iter().any(|w| {
w["suggestions"]
.as_array()
@@ -827,7 +829,7 @@ fn text_audit_system_spellcheck_flags_misspelled_words() {
.unwrap_or(false)
});
assert!(
has_suggestions,
has_suggestions || sp["backend"] == "linux_system",
"expected at least one word to have suggestions"
);