icu_testdata crates.io

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)

Examples

```rust use icu::locid::locale; use icuprovider::helloworld::HelloWorldFormatter;

// Unstable constructor HelloWorldFormatter::trynewunstable( &icu_testdata::unstable(), &locale!("en-CH").into(), ).unwrap();

// AnyProvider constructor HelloWorldFormatter::trynewwithanyprovider( &icu_testdata::any(), &locale!("en-CH").into(), ).unwrap();

// BufferProvider constructor (icu with serde feature, icu_testdata with buffer feature) HelloWorldFormatter::trynewwithbufferprovider( &icu_testdata::buffer(), &locale!("en-CH").into(), ).unwrap();

// Without fallback the locale match needs to be exact HelloWorldFormatter::trynewunstable( &icutestdata::unstablenofallback(), &locale!("en-CH").into(), ).iserr();

HelloWorldFormatter::trynewunstable( &icutestdata::unstableno_fallback(), &locale!("en").into(), ).unwrap(); ```

More Information

For more information on development, authorship, contributing etc. please visit ICU4X home page.