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) = (