Crates.io | icu_testdata |
lib.rs | icu_testdata |
version | 1.5.0 |
source | src |
created_at | 2020-10-15 15:37:14.710718 |
updated_at | 2024-05-28 20:25:50.893017 |
description | Pre-built test data for ICU4X |
homepage | https://icu4x.unicode.org |
repository | https://github.com/unicode-org/icu4x |
max_upload_size | 20971520 |
id | 300042 |
size | 41,343,960 |
🚧 This crate has been superseded by ICU4X
's compiled_data
feature and is deprecated. Data for new components will not be added, and it will not be updated for ICU4X
2.0.
icu_testdata
is a unit testing crate for ICU4X
.
The crate exposes data providers with stable data useful for unit testing. The data is based on a CLDR tag and a short list of locales that, together, cover a range of scenarios.
The crate exposes three kinds of providers, corresponding to the three types of constructors in ICU:
unstable
], [unstable_no_fallback
]any
], [any_no_fallback
]buffer
], [buffer_no_fallback
] (buffer
Cargo feature)use icu::locid::locale;
use icu_provider::hello_world::HelloWorldFormatter;
// Unstable constructor
HelloWorldFormatter::try_new_unstable(
&icu_testdata::unstable(),
&locale!("en-CH").into(),
).unwrap();
// AnyProvider constructor
HelloWorldFormatter::try_new_with_any_provider(
&icu_testdata::any(),
&locale!("en-CH").into(),
).unwrap();
// BufferProvider constructor (`icu` with `serde` feature, `icu_testdata` with `buffer` feature)
HelloWorldFormatter::try_new_with_buffer_provider(
&icu_testdata::buffer(),
&locale!("en-CH").into(),
).unwrap();
// Without fallback the locale match needs to be exact
HelloWorldFormatter::try_new_unstable(
&icu_testdata::unstable_no_fallback(),
&locale!("en-CH").into(),
).is_err();
HelloWorldFormatter::try_new_unstable(
&icu_testdata::unstable_no_fallback(),
&locale!("en").into(),
).unwrap();
For more information on development, authorship, contributing etc. please visit ICU4X home page
.