From 3a56d3180fbcde6a96338b1332f80ac7125be137 Mon Sep 17 00:00:00 2001 From: Weksa Date: Mon, 9 Nov 2026 11:03:58 +0000 Subject: [PATCH] =?UTF-8?q?Tests:=20pin=20the=20100-year=20rule,=20day=200?= =?UTF-8?q?,=20ASCII-only=20digits=20in=20dates,=20and=20the=20=E3=83=B6?= =?UTF-8?q?=20fold=20(Soul=20s19=20survivors)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- crates/weksa/tests/forms.rs | 20 ++++++++++++++++++++ crates/weksa/tests/stores.rs | 1 + 2 files changed, 21 insertions(+) diff --git a/crates/weksa/tests/forms.rs b/crates/weksa/tests/forms.rs index f0b2469..dba73c8 100644 --- a/crates/weksa/tests/forms.rs +++ b/crates/weksa/tests/forms.rs @@ -147,3 +147,23 @@ fn grade_bound_is_the_type() { assert_eq!(grade["minimum"], 0, "{grade}"); assert_eq!(schema["$defs"]["NodeId"]["pattern"], "^n[1-9][0-9]{0,3}$"); } + +#[test] +fn calendar_dates_follow_the_gregorian_rule_and_ascii_digits_only() { + use weksa::form::is_calendar_date; + for ok in ["2024-02-29", "2000-02-29", "2026-12-31"] { + assert!(is_calendar_date(ok), "{ok}"); + } + for bad in [ + "1900-02-29", + "2023-02-29", + "2026-04-31", + "2026-10-00", + "2026-00-10", + "+026-10-29", + "2026-10-2\u{669}", + "\u{6f0}026-10-29", + ] { + assert!(!is_calendar_date(bad), "{bad}"); + } +} diff --git a/crates/weksa/tests/stores.rs b/crates/weksa/tests/stores.rs index 1922c44..a8486e7 100644 --- a/crates/weksa/tests/stores.rs +++ b/crates/weksa/tests/stores.rs @@ -358,6 +358,7 @@ fn s6_folds_dotless_i_kana_and_arabic_indic_digits() { "room \u{661}\u{662}\u{663}\u{664}\u{665}\u{666}\u{667}\u{668}\u{669}\u{660}", ), ("gate 45", "gate \u{6f4}\u{6f5}"), + ("\u{3096}", "\u{30f6}"), ]; for (n, (a, b)) in pairs.into_iter().enumerate() { let (first, second) = (