mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-10 23:01:02 +00:00
text.spelling.editDictionary: say each list entry must be a single word (part of #4936)
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user