From 80e361b39a1b4dcdee03be5ea353dcd63b5c52d5 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 07:58:28 -0800 Subject: [PATCH] Tests: freehand refusal check accepts a catalog's own quotation marks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main's German row for the connect end refusal quotes the values as „start“ and „end“, so the test now looks for each accepted value inside any of the quotation mark pairs the catalogs use. --- crates/ui-egui/src/i18n/tests.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 150d26825f..600d0d57a9 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -2544,17 +2544,20 @@ fn freehand_choice_refusals_translate_with_their_values() { let b = s.execute("path.create", &json!({"d": "M10 50 L20 50"})).unwrap()["id"].clone(); let points = json!([[20, 10], [30, 30], [20, 50]]); let refusals = [ - (json!({"points": points, "style": "ink"}), ["style", "\"pencil\"", "\"brush\""]), - (json!({"points": points, "extend": {"id": a, "end": "middle"}}), ["extend", "\"start\"", "\"end\""]), - (json!({"points": points, "extend": {"id": a}, "connect": {"id": b, "end": "middle"}}), ["connect", "\"start\"", "\"end\""]), + (json!({"points": points, "style": "ink"}), "style", ["pencil", "brush"]), + (json!({"points": points, "extend": {"id": a, "end": "middle"}}), "extend", ["start", "end"]), + (json!({"points": points, "extend": {"id": a}, "connect": {"id": b, "end": "middle"}}), "connect", ["start", "end"]), ]; - for (p, words) in &refusals { + // A catalog may put the accepted values in its own quotation marks (German „start“). + let quotes = [("\"", "\""), ("„", "“"), ("“", "”"), ("«", "»"), ("« ", " »"), ("「", "」"), ("‘", "’")]; + for (p, key, values) in &refusals { let e = s.execute("path.freehand", p).unwrap_err().to_string(); assert!(e.starts_with("invalid parameters for `path.freehand`: ") && e.contains(" must be "), "{e}"); for code in COMPLETE_MESSAGES { let shown = message(Lang::from_code(code).expect("registered"), &e); - assert!(!shown.contains(" must be ") && shown.contains("`path.freehand`"), "{code}: {e} -> {shown}"); - assert!(words.iter().all(|w| shown.contains(w)), "{code}: {e} -> {shown}"); + assert!(!shown.contains(" must be ") && shown.contains("`path.freehand`") && shown.contains(key), "{code}: {e} -> {shown}"); + let quoted = |v: &str| quotes.iter().any(|(open, close)| shown.contains(&format!("{open}{v}{close}"))); + assert!(values.iter().all(|v| quoted(v)), "{code}: {e} -> {shown}"); } } }