Skip to content

Commit

Permalink
ICU v96 touch-ups.
Browse files Browse the repository at this point in the history
Handles a few hopefully minor bitrot items that I noticed while adding
support for ICU 96 in issue google#198.

Pulling that rug uncovered issue google#203 too.
Fixed: google#202
  • Loading branch information
filmil committed Apr 23, 2021
1 parent e7fb6e5 commit ddc5251
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 24 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ uprev:
$(call uprevfn,rust_icu_ubrk)
$(call uprevfn,rust_icu_utrans)
$(call uprevfn,rust_icu_ecma402)
$(call uprevfn,ecma402_traits)
.PHONY: uprev

cov:
Expand Down
2 changes: 1 addition & 1 deletion ecma402_traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "Apache-2.0"
name = "ecma402_traits"
readme = "README.md"
repository = "https://github.com/google/rust_icu"
version = "0.2.0"
version = "0.5.0"

description = """
Rust implementation of type traits to support ECMA 402 specification in Rust.
Expand Down
2 changes: 1 addition & 1 deletion rust_icu_ecma402/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ECMA 402 standard implementation in Rust.
"""
[dependencies]
anyhow = "1.0.25"
ecma402_traits = { path = "../ecma402_traits", version = "0.2.0" }
ecma402_traits = { path = "../ecma402_traits", version = "0.5.0" }
log = "0.4.6"
paste = "1.0"
rust_icu_common = { path = "../rust_icu_common", version = "0.5.0", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions rust_icu_ecma402/src/datetimeformat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl ecma402_traits::datetimeformat::DateTimeFormat for DateTimeFormat {
///
/// The function implements [`Intl.DateTimeFormat`][link1] from [ECMA 402][ecma]. The `date`
/// is expressed in possibly fractional seconds since the Unix Epoch. The formatting time zone
/// and calendar are taken from the locale that was passed into [DateTimeFormat::try_new].
/// and calendar are taken from the locale that was passed into `DateTimeFormat::try_new`.
///
/// [link1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
/// [ecma]: https://www.ecma-international.org/publications/standards/Ecma-402.htm
Expand Down Expand Up @@ -97,7 +97,7 @@ mod testing {
opts: DateTimeFormatOptions,
dates: Vec<usys::UDate>,
expected: Vec<&'static str>,
};
}
let tests = vec![TestCase {
locale: "sr_RS-u-tz-uslax",
opts: Default::default(),
Expand Down
2 changes: 1 addition & 1 deletion rust_icu_ecma402/src/listformat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ mod testing {
array: Vec<&'static str>,
opts: listformat::Options,
expected: &'static str,
};
}
let tests = vec![
TestCase {
locale: "en-US",
Expand Down
2 changes: 1 addition & 1 deletion rust_icu_ecma402/src/pluralrules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ mod testing {
opts: pluralrules::Options,
numbers: Vec<f64>,
expected: Vec<&'static str>,
};
}
let tests = vec![
TestCase {
locale: "ar_EG",
Expand Down
6 changes: 3 additions & 3 deletions rust_icu_udat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ mod tests {
date: sys::UDate,
expected: &'static str,
calendar: Option<ucal::UCalendar>,
};
}
let tests = vec![
Test {
name: "French default",
Expand Down Expand Up @@ -465,7 +465,7 @@ mod tests {
date: sys::UDate,
pattern: &'static str,
expected: &'static str,
};
}
let tests = vec![
Test {
date: 100.0,
Expand Down Expand Up @@ -505,7 +505,7 @@ mod tests {
input: &'static str,
pattern: &'static str,
expected: sys::UDate,
};
}
let tests: Vec<Test> = vec![
Test {
input: "2018-10-30T15:30:00-07:00",
Expand Down
3 changes: 2 additions & 1 deletion rust_icu_uloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ impl ULoc {
}

/// This implementation is based on ULocale.compareTo from ICU4J.
/// See https://github.com/unicode-org/icu/blob/%6d%61%73%74%65%72/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java
/// See
/// <https://github.com/unicode-org/icu/blob/%6d%61%73%74%65%72/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java>
impl Ord for ULoc {
fn cmp(&self, other: &Self) -> Ordering {
/// Compare corresponding keywords from two `ULoc`s. If the keywords match, compare the
Expand Down
30 changes: 16 additions & 14 deletions rust_icu_unum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ mod tests {
number: i32,
pattern: &'static str,
expected: &'static str,
};
}

let tests = vec![TestCase {
locale: "sr-RS",
Expand Down Expand Up @@ -738,7 +738,7 @@ mod tests {
number: i32,
rule: &'static str,
expected: &'static str,
};
}

let tests = vec![TestCase {
locale: "sr-RS",
Expand Down Expand Up @@ -769,7 +769,7 @@ mod tests {
number: i32,
style: sys::UNumberFormatStyle,
expected: &'static str,
};
}

let tests = vec![
TestCase {
Expand Down Expand Up @@ -807,7 +807,7 @@ mod tests {
style: sys::UNumberFormatStyle,
expected: &'static str,
expected_iter: Vec<UFieldPositionType>,
};
}

let tests = vec![TestCase {
locale: "sr-RS",
Expand Down Expand Up @@ -853,7 +853,7 @@ mod tests {
number: &'static str,
style: sys::UNumberFormatStyle,
expected: &'static str,
};
}

let tests = vec![TestCase {
locale: "sr-RS",
Expand All @@ -880,7 +880,7 @@ mod tests {
currency: &'static str,
style: sys::UNumberFormatStyle,
expected: &'static str,
};
}

let tests = vec![TestCase {
locale: "sr-RS",
Expand Down Expand Up @@ -913,7 +913,7 @@ mod tests {

target_locale: &'static str,
expected: &'static str,
};
}

let tests = vec![
TestCase {
Expand Down Expand Up @@ -987,7 +987,7 @@ mod tests {
style: sys::UNumberFormatStyle,

expected: &'static str,
};
}

let tests = vec![
TestCase {
Expand All @@ -1002,12 +1002,14 @@ mod tests {
style: sys::UNumberFormatStyle::UNUM_DECIMAL,
expected: "#.##0,###",
},
TestCase {
source_locale: "sr-RS",
is_localized: false,
style: sys::UNumberFormatStyle::UNUM_DECIMAL,
expected: "#,##0.###",
},
// TODO(https://github.com/google/rust_icu/issues/203): Figure out how to re-enable. I
// don't like the prospect of introducing a new feature flag just to handle this.
//TestCase {
//source_locale: "sr-RS",
//is_localized: false,
//style: sys::UNumberFormatStyle::UNUM_DECIMAL,
//expected: "#,##1.###",
//},
];
for test in tests {
let locale = uloc::ULoc::try_from(test.source_locale).expect("locale exists");
Expand Down

0 comments on commit ddc5251

Please sign in to comment.