diff --git a/src/app/control/p1_tests.rs b/src/app/control/p1_tests.rs index 3ad5b8b6a..331142ce6 100644 --- a/src/app/control/p1_tests.rs +++ b/src/app/control/p1_tests.rs @@ -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" ); diff --git a/src/app/control/spellcheck.rs b/src/app/control/spellcheck.rs index 8ab3abb23..704a961be 100644 --- a/src/app/control/spellcheck.rs +++ b/src/app/control/spellcheck.rs @@ -595,7 +595,7 @@ pub(crate) mod linux_impl { use std::collections::HashSet; use std::fs::File; use std::io::{BufRead, BufReader}; - use std::path::{Path, PathBuf}; + use std::path::Path; const LINUX_DICT_DIRS: &[&str] = &[ "/usr/share/hunspell", @@ -645,7 +645,8 @@ pub(crate) mod linux_impl { } } - let has_cli = is_command_in_path("hunspell") || is_command_in_path("aspell"); + // Only hunspell is ever invoked (`check_via_cli`), so only it counts. + let has_cli = is_command_in_path("hunspell"); if !found_any && !has_cli { return None; @@ -683,7 +684,9 @@ pub(crate) mod linux_impl { } } - (!self.words.is_empty() && !self.words.contains(&clean), Vec::new()) + // Not in the wordlist and no CLI answer: misspelled when there is + // a wordlist to judge by, unjudged (accepted) when there is none. + (self.words.is_empty(), Vec::new()) } }