Skip to content

Commit

Permalink
Audit or fix ignored tests (#5138)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian authored Jul 1, 2024
1 parent 42556e5 commit c81bb30
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 41 deletions.
4 changes: 2 additions & 2 deletions components/calendar/src/islamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2149,7 +2149,7 @@ mod test {
}
}

#[ignore]
#[ignore] // slow
#[test]
fn test_days_in_provided_year_observational() {
let calendar = IslamicObservational::new();
Expand Down Expand Up @@ -2179,7 +2179,7 @@ mod test {
);
}

#[ignore]
#[ignore] // slow
#[test]
fn test_days_in_provided_year_ummalqura() {
let calendar = IslamicUmmAlQura::new();
Expand Down
36 changes: 2 additions & 34 deletions components/collator/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,16 +622,12 @@ fn test_ja_chooon_kigoo() {
}
}

// TODO: This test should eventually test fallback
// TODO: Test Swedish and Chinese also, since they have unusual
// variant defaults. (But are currently not part of the test data.)
#[ignore]
#[test]
fn test_region_fallback() {
// There's no explicit fi-FI data.
let locale: Locale = "fi-u-co-standard".parse().unwrap();

// let locale = locale!("fi-FI").into();
let locale = locale!("fi-FI");

let collator = Collator::try_new(&locale.into(), CollatorOptions::new()).unwrap();
assert_eq!(collator.compare("ä", "z"), Ordering::Greater);
Expand Down Expand Up @@ -694,8 +690,8 @@ fn test_vi() {
}
}

#[ignore]
#[test]
// See DatagenProvider test_zh_non_baked for gb2312 and big5han tests
fn test_zh() {
// Note: ㄅ is Bopomofo.

Expand Down Expand Up @@ -735,20 +731,6 @@ fn test_zh() {
assert_eq!(collator.compare("佰", "ㄅ"), Ordering::Less);
assert_eq!(collator.compare("不", "把"), Ordering::Greater);
}
{
let locale: Locale = "zh-u-co-gb2312".parse().unwrap();
let collator = Collator::try_new(&locale.into(), CollatorOptions::new()).unwrap();
assert_eq!(collator.compare("艾", "a"), Ordering::Greater);
assert_eq!(collator.compare("佰", "a"), Ordering::Greater);
assert_eq!(collator.compare("ㄅ", "a"), Ordering::Greater);
assert_eq!(collator.compare("ㄅ", "ж"), Ordering::Greater);
assert_eq!(collator.compare("艾", "佰"), Ordering::Less);
// In GB2312 proper, Bopomofo comes before Han, but the
// collation leaves Bopomofo unreordered, so it comes after.
assert_eq!(collator.compare("艾", "ㄅ"), Ordering::Less);
assert_eq!(collator.compare("佰", "ㄅ"), Ordering::Less);
assert_eq!(collator.compare("不", "把"), Ordering::Greater);
}
{
let locale: Locale = "zh-u-co-stroke".parse().unwrap();
let collator = Collator::try_new(&locale.into(), CollatorOptions::new()).unwrap();
Expand Down Expand Up @@ -785,18 +767,6 @@ fn test_zh() {
assert_eq!(collator.compare("佰", "ㄅ"), Ordering::Less);
assert_eq!(collator.compare("不", "把"), Ordering::Less);
}
{
let locale: Locale = "zh-u-co-big5han".parse().unwrap();
let collator = Collator::try_new(&locale.into(), CollatorOptions::new()).unwrap();
assert_eq!(collator.compare("艾", "a"), Ordering::Greater);
assert_eq!(collator.compare("佰", "a"), Ordering::Greater);
assert_eq!(collator.compare("ㄅ", "a"), Ordering::Greater);
assert_eq!(collator.compare("ㄅ", "ж"), Ordering::Less);
assert_eq!(collator.compare("艾", "佰"), Ordering::Less);
assert_eq!(collator.compare("艾", "ㄅ"), Ordering::Less);
assert_eq!(collator.compare("佰", "ㄅ"), Ordering::Less);
assert_eq!(collator.compare("不", "把"), Ordering::Less);
}
// TODO: Test script and region aliases
}

Expand Down Expand Up @@ -1044,7 +1014,6 @@ fn test_tr_primary() {
}
}

#[ignore]
#[test]
fn test_lt_tertiary() {
let left = [
Expand Down Expand Up @@ -1079,7 +1048,6 @@ fn test_lt_tertiary() {
}
}

#[ignore]
#[test]
fn test_lt_primary() {
let left = ["ž"];
Expand Down
4 changes: 2 additions & 2 deletions components/datetime/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ macro_rules! size_test {
};
}
#[test]
#[cfg_attr(not(icu4x_run_size_tests), ignore)]
#[cfg_attr(not(icu4x_run_size_tests), ignore)] // Doesn't work on arbitrary Rust versions
fn $id() {
let size = core::mem::size_of::<$ty>();
let success = match option_env!("CI_TOOLCHAIN") {
Expand Down Expand Up @@ -67,7 +67,7 @@ macro_rules! size_test {
};
}
#[test]
#[cfg_attr(not(icu4x_run_size_tests), ignore)]
#[cfg_attr(not(icu4x_run_size_tests), ignore)] // Doesn't work on arbitrary Rust versions
fn $id() {
let size = core::mem::size_of::<$ty>();
let expected = $size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ mod tests {
}

#[test]
#[ignore] // not clear from the spec whether this test is correct
fn test_multi_3_initial_should_still_only_be_2() -> Result<(), PersonNamesFormatterError> {
let mut person_data = LiteMap::new();
person_data.insert(
Expand All @@ -127,7 +126,9 @@ mod tests {
};
let result =
super::derive_missing_initials(&person_name, &requested_field, "{0}.", "{0} {1}");
assert_eq!(result, "M. J.");

// TODO(#3077): broken, this should be equal
assert_ne!(result, "M. J.");
Ok(())
}
}
2 changes: 1 addition & 1 deletion components/segmenter/tests/css_word_break.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ fn wordbreak_keepall() {
}

#[test]
#[cfg_attr(not(feature = "lstm"), ignore)]
#[cfg(feature = "lstm")]
fn wordbreak_keepall_lstm() {
// from css/css-text/word-break/word-break-keep-all-003.html
let s = "และและ";
Expand Down
45 changes: 45 additions & 0 deletions provider/bikeshed/src/collator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,48 @@ collation_provider!(
),
toml_data
);

#[test]

fn test_zh_non_baked() {
use core::cmp::Ordering;
use icu::collator::{Collator, CollatorOptions};
use icu_provider_adapters::fallback::LocaleFallbackProvider;

let provider =
LocaleFallbackProvider::try_new_unstable(DatagenProvider::new_testing()).unwrap();

// Note: ㄅ is Bopomofo.
{
let locale = "zh-u-co-gb2312".parse().unwrap();
let collator =
Collator::try_new_unstable(&provider, &locale, CollatorOptions::new()).unwrap();
assert_eq!(collator.compare("艾", "a"), Ordering::Greater);
assert_eq!(collator.compare("佰", "a"), Ordering::Greater);
assert_eq!(collator.compare("ㄅ", "a"), Ordering::Greater);
assert_eq!(collator.compare("ㄅ", "ж"), Ordering::Greater);

// TODO(#5136): broken, these should be equal
assert_ne!(collator.compare("艾", "佰"), Ordering::Less);
// In GB2312 proper, Bopomofo comes before Han, but the
// collation leaves Bopomofo unreordered, so it comes after.
assert_ne!(collator.compare("艾", "ㄅ"), Ordering::Less);
assert_ne!(collator.compare("佰", "ㄅ"), Ordering::Less);
assert_ne!(collator.compare("不", "把"), Ordering::Greater);
}
{
let locale = "zh-u-co-big5han".parse().unwrap();
let collator =
Collator::try_new_unstable(&provider, &locale, CollatorOptions::new()).unwrap();
assert_eq!(collator.compare("艾", "a"), Ordering::Greater);
assert_eq!(collator.compare("佰", "a"), Ordering::Greater);
assert_eq!(collator.compare("ㄅ", "a"), Ordering::Greater);
assert_eq!(collator.compare("不", "把"), Ordering::Less);

// TODO(#5136): broken, these should be equal
assert_ne!(collator.compare("ㄅ", "ж"), Ordering::Less);
assert_ne!(collator.compare("艾", "佰"), Ordering::Less);
assert_ne!(collator.compare("艾", "ㄅ"), Ordering::Less);
assert_ne!(collator.compare("佰", "ㄅ"), Ordering::Less);
}
}

0 comments on commit c81bb30

Please sign in to comment.