10 releases (3 stable)

new 1.1.1 Jan 31, 2023
1.0.0 Sep 27, 2022
0.6.0 May 17, 2022
0.5.0 Jan 31, 2022
0.1.0 Oct 15, 2020

#13 in #cldr

Download history 503/week @ 2022-10-10 489/week @ 2022-10-17 327/week @ 2022-10-24 213/week @ 2022-10-31 246/week @ 2022-11-07 368/week @ 2022-11-14 229/week @ 2022-11-21 117/week @ 2022-11-28 213/week @ 2022-12-05 228/week @ 2022-12-12 219/week @ 2022-12-19 99/week @ 2022-12-26 23/week @ 2023-01-02 156/week @ 2023-01-09 127/week @ 2023-01-16 180/week @ 2023-01-23

487 downloads per month
Used in 6 crates (4 directly)

Unicode-DFS-2016

16MB
58K SLoC

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

use icu::locid::locale;
use icu_provider::hello_world::*;
use icu_provider::prelude::*;

let req = DataRequest {
    locale: &locale!("en").into(),
    metadata: Default::default(),
};

assert_eq!(
    DataProvider::<HelloWorldV1Marker>::load(
        &icu_testdata::unstable(),
        req
    )
    .and_then(DataResponse::take_payload)
    .unwrap()
    .get()
    .message,
    "Hello World"
);

assert_eq!(
    BufferProvider::load_buffer(
        &icu_testdata::buffer(),
        HelloWorldV1Marker::KEY,
        req
    )
    .and_then(DataResponse::take_payload)
    .unwrap()
    .get(),
    &b"\x0bHello World"
);

assert_eq!(
    AnyProvider::load_any(
        &icu_testdata::any(),
        HelloWorldV1Marker::KEY,
        req
    )
    .and_then(AnyResponse::downcast::<HelloWorldV1Marker>)
    .and_then(DataResponse::take_payload)
    .unwrap()
    .get()
    .message,
    "Hello World"
);

More Information

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

Dependencies