text.spelling.editDictionary: say each list entry must be a single word (part of #4936)

This commit is contained in:
HassanKhan
2026-11-10 22:13:23 +05:00
parent 9ab5c033b1
commit 5080a8eced
2 changed files with 5 additions and 3 deletions
+3 -3
View File
@@ -370,9 +370,9 @@ fn word_list(p: &Value, key: &str, command: &str) -> Result<BTreeSet<String>> {
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()
}
+2
View File
@@ -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"));
}