mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 07:57:47 +00:00
i18n: the shipped-locale collation test checks each locale's own order
This commit is contained in:
+41
-39
@@ -131,48 +131,50 @@ mod tests {
|
|||||||
v
|
v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Each tailored locale puts a pair in another order than the root collation does, which a
|
||||||
|
/// locale whose data is missing (it falls back to root) wouldn't.
|
||||||
#[test]
|
#[test]
|
||||||
fn every_shipped_locale_has_its_data() {
|
fn every_shipped_locale_has_its_data() {
|
||||||
for locale in [
|
let root = Collator::new("und");
|
||||||
"en",
|
for (locale, first, second) in [
|
||||||
"ar",
|
("ar", "ب", "a"),
|
||||||
"bg",
|
("bg", "б", "a"),
|
||||||
"cs",
|
("cs", "hrad", "chata"),
|
||||||
"da",
|
("da", "zebra", "år"),
|
||||||
"de",
|
("el", "β", "a"),
|
||||||
"el",
|
("es", "nube", "ñu"),
|
||||||
"es",
|
("et", "wc", "õun"),
|
||||||
"et",
|
("fa", "ب", "a"),
|
||||||
"fa",
|
("fi", "zeta", "äiti"),
|
||||||
"fi",
|
("hi", "क", "a"),
|
||||||
"fr",
|
("hr", "cvijet", "čaj"),
|
||||||
"hi",
|
("hu", "cukor", "csak"),
|
||||||
"hr",
|
("ja", "亜", "一"),
|
||||||
"hu",
|
("ka", "ა", "a"),
|
||||||
"id",
|
("kk", "б", "a"),
|
||||||
"it",
|
("ko", "가", "a"),
|
||||||
"ja",
|
("lt", "yra", "jau"),
|
||||||
"ka",
|
("pl", "az", "ąb"),
|
||||||
"kk",
|
("ru", "б", "a"),
|
||||||
"ko",
|
("sl", "cvet", "čaj"),
|
||||||
"lt",
|
("sr", "б", "a"),
|
||||||
"nl",
|
("sr-latn", "cvijet", "čaj"),
|
||||||
"pl",
|
("sv", "zebra", "år"),
|
||||||
"pt-br",
|
("te", "క", "a"),
|
||||||
"ru",
|
("tr", "cz", "ça"),
|
||||||
"sl",
|
("uk", "б", "a"),
|
||||||
"sr",
|
("vi", "az", "ăn"),
|
||||||
"sr-latn",
|
("zh-hans", "阿", "中"),
|
||||||
"sv",
|
("zh-hant", "人", "丈"),
|
||||||
"te",
|
|
||||||
"tr",
|
|
||||||
"uk",
|
|
||||||
"vi",
|
|
||||||
"zh-hans",
|
|
||||||
"zh-hant",
|
|
||||||
"not a locale",
|
|
||||||
] {
|
] {
|
||||||
assert!(Collator::new(locale).0.is_some(), "{locale}");
|
assert_eq!(Collator::new(locale).compare(first, second), Ordering::Less, "{locale}: {first} < {second}");
|
||||||
|
assert_eq!(root.compare(first, second), Ordering::Greater, "root: {second} < {first}");
|
||||||
|
}
|
||||||
|
// CLDR doesn't tailor these: they sort in the root order.
|
||||||
|
for locale in ["en", "de", "fr", "id", "it", "nl", "pt-br", "not a locale"] {
|
||||||
|
let collator = Collator::new(locale);
|
||||||
|
assert!(collator.0.is_some(), "{locale}");
|
||||||
|
assert_eq!(collator.compare("čaj", "cvijet"), Ordering::Less, "{locale}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user