diff --git a/crates/engine/src/cmd/spelling.rs b/crates/engine/src/cmd/spelling.rs index 641f6a4fe..35d1a1277 100644 --- a/crates/engine/src/cmd/spelling.rs +++ b/crates/engine/src/cmd/spelling.rs @@ -370,9 +370,9 @@ fn word_list(p: &Value, key: &str, command: &str) -> Result> { words .iter() .map(|w| { - w.as_str().and_then(craft_proof::custom_word).ok_or_else(|| { - bad(command, format!("`{key}` must hold words of one word, at most {} characters", craft_proof::MAX_CUSTOM_WORD_CHARS)) - }) + w.as_str() + .and_then(craft_proof::custom_word) + .ok_or_else(|| bad(command, format!("`{key}` must hold single words of at most {} characters", craft_proof::MAX_CUSTOM_WORD_CHARS))) }) .collect() } diff --git a/crates/engine/src/tests/spelling.rs b/crates/engine/src/tests/spelling.rs index 889458ac5..16d7f0199 100644 --- a/crates/engine/src/tests/spelling.rs +++ b/crates/engine/src/tests/spelling.rs @@ -291,6 +291,8 @@ fn a_dictionary_edit_is_saved_whole_or_not_at_all() { assert!(s.execute(EDIT, &p).is_err(), "{EDIT} refuses a bad list"); assert!(in_dictionary(&mut s, "pqzvkb"), "{EDIT} changed nothing"); } + let e = s.execute(EDIT, &json!({"add": ["a b"]})).unwrap_err().to_string(); + assert!(e.contains("must hold single words of at most 64 characters"), "{e}"); run(&mut s, EDIT, json!({"remove": ["pqzvkb", "pqzvkc"]})); assert!(!in_dictionary(&mut s, "pqzvkb") && !in_dictionary(&mut s, "pqzvkc")); }