Skip to content

Commit

Permalink
Use testdata everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
zbraniecki committed Oct 9, 2020
1 parent 52300b8 commit 3cba81f
Show file tree
Hide file tree
Showing 54 changed files with 28 additions and 169 deletions.
2 changes: 1 addition & 1 deletion components/datetime/benches/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use icu_fs_data_provider::FsDataProvider;
fn datetime_benches(c: &mut Criterion) {
let fxs = fixtures::get_fixture("styles").unwrap();

let provider = FsDataProvider::try_new("./tests/fixtures/data/icu4x")
let provider = FsDataProvider::try_new("../../resources/testdata/data/json")
.expect("Loading file from testdata directory");

{
Expand Down
24 changes: 12 additions & 12 deletions components/datetime/benches/fixtures/tests/styles.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"setups": [
{
"locale": "pl",
"locale": "be",
"options": {
"style": {
"date": "full",
Expand All @@ -11,7 +11,7 @@
}
},
{
"locale": "pl",
"locale": "be",
"options": {
"style": {
"date": "long",
Expand All @@ -20,7 +20,7 @@
}
},
{
"locale": "pl",
"locale": "be",
"options": {
"style": {
"date": "medium",
Expand All @@ -29,7 +29,7 @@
}
},
{
"locale": "pl",
"locale": "be",
"options": {
"style": {
"date": "short",
Expand All @@ -38,7 +38,7 @@
}
},
{
"locale": "pl",
"locale": "be",
"options": {
"style": {
"date": null,
Expand All @@ -47,7 +47,7 @@
}
},
{
"locale": "pl",
"locale": "be",
"options": {
"style": {
"date": null,
Expand All @@ -56,7 +56,7 @@
}
},
{
"locale": "pl",
"locale": "be",
"options": {
"style": {
"date": null,
Expand All @@ -65,7 +65,7 @@
}
},
{
"locale": "pl",
"locale": "be",
"options": {
"style": {
"date": null,
Expand All @@ -74,7 +74,7 @@
}
},
{
"locale": "pl",
"locale": "be",
"options": {
"style": {
"date": "full",
Expand All @@ -83,7 +83,7 @@
}
},
{
"locale": "pl",
"locale": "be",
"options": {
"style": {
"date": "long",
Expand All @@ -92,7 +92,7 @@
}
},
{
"locale": "pl",
"locale": "be",
"options": {
"style": {
"date": "medium",
Expand All @@ -101,7 +101,7 @@
}
},
{
"locale": "pl",
"locale": "be",
"options": {
"style": {
"date": "short",
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/examples/work_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn print(_input: &str, _value: Option<usize>) {
fn main() {
let langid: LanguageIdentifier = "en".parse().expect("Failed to parse Language Identifier.");

let provider = FsDataProvider::try_new("./tests/fixtures/data/icu4x")
let provider = FsDataProvider::try_new("../../resources/testdata/data/json")
.expect("Loading file from testdata directory");

let dates = DATES_ISO
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/tests/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::fmt::Write;

#[test]
fn test_fixtures() {
let provider = FsDataProvider::try_new("./tests/fixtures/data/icu4x")
let provider = FsDataProvider::try_new("../../resources/testdata/data/json")
.expect("Loading file from testdata directory");

for fx in fixtures::get_fixture("styles").unwrap().0 {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions components/datetime/tests/fixtures/data/icu4x/manifest.json

This file was deleted.

4 changes: 2 additions & 2 deletions components/datetime/tests/fixtures/tests/styles.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
},
{
"input": {
"locale": "pl",
"locale": "be",
"value": "2020-03-21T08:25:07.000",
"options": {
"style": {
Expand All @@ -101,7 +101,7 @@
}
},
"output": {
"value": "sobota, 21 marca 2020 08:25:07 zzzz"
"value": "субота, 21 сакавіка 2020 'г'. 'у' 08:25:07, zzzz"
}
}
]
8 changes: 4 additions & 4 deletions components/fs-data-provider/tests/test_file_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ use std::borrow::Cow;

#[test]
fn test_read_json() {
let provider = FsDataProvider::try_new("tests/testdata/json_plurals_37")
let provider = FsDataProvider::try_new("../../resources/testdata/data/json")
.expect("Loading file from testdata directory");
let response = provider
.load(&DataRequest {
data_key: icu_data_key!(plurals: cardinal@1),
data_entry: DataEntry {
variant: None,
// TODO: Migrate to LanguageIdentifier macro
langid: "sr".parse().expect("Valid language tag"),
langid: "en".parse().expect("Valid language tag"),
},
})
.expect("The key should be present in the testdata");
Expand All @@ -24,9 +24,9 @@ fn test_read_json() {
plurals_data,
&structs::plurals::PluralRuleStringsV1 {
zero: None,
one: Some(Cow::Borrowed("v = 0 and i % 10 = 1 and i % 100 != 11 or f % 10 = 1 and f % 100 != 11 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, … @decimal 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 10.1, 100.1, 1000.1, …")),
one: Some(Cow::Borrowed("i = 1 and v = 0")),
two: None,
few: Some(Cow::Borrowed("v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14 @integer 2~4, 22~24, 32~34, 42~44, 52~54, 62, 102, 1002, … @decimal 0.2~0.4, 1.2~1.4, 2.2~2.4, 3.2~3.4, 4.2~4.4, 5.2, 10.2, 100.2, 1000.2, …")),
few: None,
many: None,
}
);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion components/pluralrules/benches/fixtures/plurals.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"langs": ["uk", "de", "sk", "ar", "fr", "it", "en", "cs", "es", "zh"]
"langs": ["be", "bn", "en", "fa", "fr", "und", "zh"]
}
2 changes: 1 addition & 1 deletion components/pluralrules/benches/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn parser(c: &mut Criterion) {

let plurals_data = helpers::get_plurals_data();

let provider = FsDataProvider::try_new("./tests/data/json_plurals_37")
let provider = FsDataProvider::try_new("../../resources/testdata/data/json")
.expect("Loading file from testdata directory");

let mut rules = vec![];
Expand Down
2 changes: 1 addition & 1 deletion components/pluralrules/benches/pluralrules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn pluralrules(c: &mut Criterion) {
let plurals_data = helpers::get_plurals_data();
let numbers_data = helpers::get_numbers_data();

let provider = FsDataProvider::try_new("./tests/data/json_plurals_37")
let provider = FsDataProvider::try_new("../../resources/testdata/data/json")
.expect("Loading file from testdata directory");

c.bench_function("pluralrules/overview", |b| {
Expand Down
2 changes: 1 addition & 1 deletion components/pluralrules/examples/elevator_floors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn print(_input: &str, _value: Option<usize>) {

fn main() {
let langid: LanguageIdentifier = "en".parse().expect("Failed to parse Language Identifier.");
let dtp = FsDataProvider::try_new("./tests/data/json_plurals_37")
let dtp = FsDataProvider::try_new("../../resources/testdata/data/json")
.expect("Loading file from testdata directory");

{
Expand Down
2 changes: 1 addition & 1 deletion components/pluralrules/examples/unread_emails.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn print(_input: &str, _value: Option<usize>) {

fn main() {
let langid: LanguageIdentifier = "en".parse().expect("Failed to parse Language Identifier.");
let dtp = FsDataProvider::try_new("./tests/data/json_plurals_37")
let dtp = FsDataProvider::try_new("../../resources/testdata/data/json")
.expect("Loading file from testdata directory");

{
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3cba81f

Please sign in to comment.