diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
commit | 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 (patch) | |
tree | daf049b282ab10e8c3d03e409b3cd84ff3f7690c /vendor/icu_provider_adapters/src/fallback/algorithms.rs | |
parent | Adding debian version 1.68.2+dfsg1-1. (diff) | |
download | rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.tar.xz rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.zip |
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/icu_provider_adapters/src/fallback/algorithms.rs')
-rw-r--r-- | vendor/icu_provider_adapters/src/fallback/algorithms.rs | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/vendor/icu_provider_adapters/src/fallback/algorithms.rs b/vendor/icu_provider_adapters/src/fallback/algorithms.rs index 9af52ef6d..0edc59304 100644 --- a/vendor/icu_provider_adapters/src/fallback/algorithms.rs +++ b/vendor/icu_provider_adapters/src/fallback/algorithms.rs @@ -207,6 +207,7 @@ mod tests { use super::*; use icu_locid::Locale; use std::str::FromStr; + use writeable::Writeable; struct TestCase { input: &'static str, @@ -355,6 +356,25 @@ mod tests { expected_region_chain: &["hi-Latn-IN", "und-IN"], }, TestCase { + input: "zh-CN", + requires_data: true, + extension_key: None, + fallback_supplement: None, + // Note: "zh-Hans" is not reachable because it is the default script for "zh". + // The fallback algorithm does not visit the language-script bundle when the + // script is the default for the language + expected_language_chain: &["zh-CN", "zh"], + expected_region_chain: &["zh-CN", "und-CN"], + }, + TestCase { + input: "zh-TW", + requires_data: true, + extension_key: None, + fallback_supplement: None, + expected_language_chain: &["zh-TW", "zh-Hant-TW", "zh-Hant"], + expected_region_chain: &["zh-TW", "und-TW"], + }, + TestCase { input: "yue-HK", requires_data: true, extension_key: None, @@ -396,10 +416,10 @@ mod tests { }; let locale = DataLocale::from(Locale::from_str(cas.input).unwrap()); let mut it = key_fallbacker.fallback_for(locale); - for expected in expected_chain { + for &expected in expected_chain { assert_eq!( expected, - &it.get().to_string(), + &*it.get().write_to_string(), "{:?} ({:?})", cas.input, priority @@ -408,7 +428,7 @@ mod tests { } assert_eq!( "und", - it.get().to_string(), + &*it.get().write_to_string(), "{:?} ({:?})", cas.input, priority |