Skip to content

Commit

Permalink
Rebaseline intl tests for latest ICU
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=274339
rdar://128296361

Unreviewed, rebaseline intl tests.

* JSTests/stress/intl-datetimeformat.js:
* JSTests/stress/intl-numberformat.js:
(shouldBeOneOf):

Canonical link: https://commits.webkit.org/278954@main
  • Loading branch information
kmiller68 committed May 18, 2024
1 parent fe7d1bf commit 9a2f01e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions JSTests/stress/intl-datetimeformat.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ shouldBe(Intl.DateTimeFormat('en').resolvedOptions().second, undefined);
shouldBe(Intl.DateTimeFormat('en').resolvedOptions().timeZoneName, undefined);

// Locale-sensitive format().
shouldBe(Intl.DateTimeFormat('ar', { timeZone: 'America/Denver' }).format(1451099872641), '٢٥‏/١٢‏/٢٠١٥');
shouldBeOneOf(Intl.DateTimeFormat('ar', { timeZone: 'America/Denver' }).format(1451099872641), ['٢٥‏/١٢‏/٢٠١٥', '25‏/12‏/2015']);
shouldBe(Intl.DateTimeFormat('de', { timeZone: 'America/Denver' }).format(1451099872641), '25.12.2015');
shouldBe(Intl.DateTimeFormat('ja', { timeZone: 'America/Denver' }).format(1451099872641), '2015/12/25');
shouldBe(Intl.DateTimeFormat('pt', { timeZone: 'America/Denver' }).format(1451099872641), '25/12/2015');
Expand Down Expand Up @@ -298,7 +298,7 @@ shouldBe(Intl.DateTimeFormat('en', { timeZone: 'Pacific/Auckland' }).format(1451
// Gets default calendar and numberingSystem from locale.
shouldBe(Intl.DateTimeFormat('ar-sa').resolvedOptions().locale, 'ar-SA');
shouldBe(Intl.DateTimeFormat('fa-IR').resolvedOptions().calendar, 'persian');
shouldBe(Intl.DateTimeFormat('ar').resolvedOptions().numberingSystem, 'arab');
shouldBeOneOf(Intl.DateTimeFormat('ar').resolvedOptions().numberingSystem, ['arab','latn']);

shouldBe(Intl.DateTimeFormat('en', { calendar: 'dangi' }).resolvedOptions().calendar, 'dangi');
shouldBe(Intl.DateTimeFormat('en-u-ca-bogus').resolvedOptions().locale, 'en');
Expand Down
8 changes: 7 additions & 1 deletion JSTests/stress/intl-numberformat.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ function shouldBe(actual, expected) {
throw new Error(`expected ${expected} but got ${actual}`);
}

function shouldBeOneOf(actual, expectedArray) {
if (!expectedArray.some((value) => value === actual))
throw new Error('bad value: ' + actual + ' expected values: ' + expectedArray);
}


function shouldNotThrow(func) {
func();
}
Expand Down Expand Up @@ -460,7 +466,7 @@ shouldThrow(() => Intl.NumberFormat.prototype.resolvedOptions.call(5), TypeError
// BigInt tests
shouldBe(Intl.NumberFormat().format(0n), '0');
shouldBe(Intl.NumberFormat().format(BigInt(1)), '1');
shouldBe(Intl.NumberFormat('ar').format(123456789n), '١٢٣٬٤٥٦٬٧٨٩');
shouldBeOneOf(Intl.NumberFormat('ar').format(123456789n), ['١٢٣٬٤٥٦٬٧٨٩','123,456,789']);
shouldBe(Intl.NumberFormat('zh-Hans-CN-u-nu-hanidec').format(123456789n), '一二三,四五六,七八九');
shouldBe(Intl.NumberFormat('en', { maximumSignificantDigits: 3 }).format(123456n), '123,000');

Expand Down

0 comments on commit 9a2f01e

Please sign in to comment.