Title: [293445] trunk/JSTests
Revision
293445
Author
[email protected]
Date
2022-04-26 13:01:08 -0700 (Tue, 26 Apr 2022)

Log Message

Several internationalization tests broken with ICU 69.1
https://bugs.webkit.org/show_bug.cgi?id=239724

Patch by Michael Catanzaro <[email protected]> on 2022-04-26
Reviewed by Ross Kirsling and Yusuke Suzuki.

Update these tests to be more permissive of different results for different ICU versions.
ICU 69 on macOS is producing different results from ICU 69 on Linux for reasons unexplained,
so instead of checking the version number, let's instead just accept both ways.

* stress/array-toLocaleString.js:
(shouldBeOneOf):
* stress/date-toLocaleString.js:
(shouldBeOneOf):
* stress/intl-datetimeformat-formatrange-relevant-extensions-ja.js:
(shouldBeOneOf):
(vm.icuVersion):
(shouldBeOneOfThem): Deleted.
* stress/intl-datetimeformat-formatrangetoparts-relevant-extensions-ja.js:
(shouldBeOneOf):
* stress/intl-datetimeformat.js:
(shouldBeOneOf):
(shouldBeOneOfThem): Deleted.
* stress/intl-locale-info.js:
(shouldBeOneOf):
(shouldBe):
* stress/intl-locale.js:
(shouldBeOneOf):

Canonical link: https://commits.webkit.org/250000@main

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (293444 => 293445)


--- trunk/JSTests/ChangeLog	2022-04-26 19:31:41 UTC (rev 293444)
+++ trunk/JSTests/ChangeLog	2022-04-26 20:01:08 UTC (rev 293445)
@@ -1,3 +1,33 @@
+2022-04-26  Michael Catanzaro  <[email protected]>
+
+        Several internationalization tests broken with ICU 69.1
+        https://bugs.webkit.org/show_bug.cgi?id=239724
+
+        Reviewed by Ross Kirsling and Yusuke Suzuki.
+
+        Update these tests to be more permissive of different results for different ICU versions.
+        ICU 69 on macOS is producing different results from ICU 69 on Linux for reasons unexplained,
+        so instead of checking the version number, let's instead just accept both ways.
+
+        * stress/array-toLocaleString.js:
+        (shouldBeOneOf):
+        * stress/date-toLocaleString.js:
+        (shouldBeOneOf):
+        * stress/intl-datetimeformat-formatrange-relevant-extensions-ja.js:
+        (shouldBeOneOf):
+        (vm.icuVersion):
+        (shouldBeOneOfThem): Deleted.
+        * stress/intl-datetimeformat-formatrangetoparts-relevant-extensions-ja.js:
+        (shouldBeOneOf):
+        * stress/intl-datetimeformat.js:
+        (shouldBeOneOf):
+        (shouldBeOneOfThem): Deleted.
+        * stress/intl-locale-info.js:
+        (shouldBeOneOf):
+        (shouldBe):
+        * stress/intl-locale.js:
+        (shouldBeOneOf):
+
 2022-04-24  Zan Dobersek  <[email protected]>
 
         Skip microbenchmarks/memcpy-wasm.js and friends on non-FTL (i.e. non-WASM) platforms

Modified: trunk/JSTests/stress/array-toLocaleString.js (293444 => 293445)


--- trunk/JSTests/stress/array-toLocaleString.js	2022-04-26 19:31:41 UTC (rev 293444)
+++ trunk/JSTests/stress/array-toLocaleString.js	2022-04-26 20:01:08 UTC (rev 293445)
@@ -3,6 +3,11 @@
         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 shouldThrow(func, errorType) {
     let error;
     try {
@@ -38,4 +43,4 @@
 
 // Test that parameters are passed through properly.
 shouldThrow(() => [ new Date ].toLocaleString('i'), RangeError);
-shouldBe([ new Date(NaN), new Date(0) ].toLocaleString('zh-Hans-CN-u-nu-hanidec', { timeZone: 'UTC' }), $vm.icuVersion() >= 69 ? 'Invalid Date,一九七〇/一/一 〇〇:〇〇:〇〇' : 'Invalid Date,一九七〇/一/一 上午一二:〇〇:〇〇');
+shouldBeOneOf([ new Date(NaN), new Date(0) ].toLocaleString('zh-Hans-CN-u-nu-hanidec', { timeZone: 'UTC' }), [ 'Invalid Date,一九七〇/一/一 〇〇:〇〇:〇〇', 'Invalid Date,一九七〇/一/一 上午一二:〇〇:〇〇' ]);

Modified: trunk/JSTests/stress/date-toLocaleString.js (293444 => 293445)


--- trunk/JSTests/stress/date-toLocaleString.js	2022-04-26 19:31:41 UTC (rev 293444)
+++ trunk/JSTests/stress/date-toLocaleString.js	2022-04-26 20:01:08 UTC (rev 293445)
@@ -3,6 +3,11 @@
         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();
 }
@@ -44,8 +49,8 @@
 // Test for DateTimeFormat behavior.
 // Test that locale parameter is passed through properly.
 shouldThrow(() => new Date().toLocaleString('i'), RangeError);
-shouldBe(new Date(0).toLocaleString('zh-Hans-CN-u-nu-hanidec', { timeZone: 'UTC' }), $vm.icuVersion() >= 69 ? '一九七〇/一/一 〇〇:〇〇:〇〇' : '一九七〇/一/一 上午一二:〇〇:〇〇');
-shouldBe(new Date(0).toLocaleString('zh-Hans-CN', { timeZone: 'UTC', numberingSystem: 'hanidec' }), $vm.icuVersion() >= 69 ? '一九七〇/一/一 〇〇:〇〇:〇〇' : '一九七〇/一/一 上午一二:〇〇:〇〇');
+shouldBeOneOf(new Date(0).toLocaleString('zh-Hans-CN-u-nu-hanidec', { timeZone: 'UTC' }), [ '一九七〇/一/一 〇〇:〇〇:〇〇', '一九七〇/一/一 上午一二:〇〇:〇〇' ]);
+shouldBeOneOf(new Date(0).toLocaleString('zh-Hans-CN', { timeZone: 'UTC', numberingSystem: 'hanidec' }), [ '一九七〇/一/一 〇〇:〇〇:〇〇', '一九七〇/一/一 上午一二:〇〇:〇〇' ]);
 shouldBe(new Date(0).toLocaleString('en-u-ca-chinese', { timeZone: 'UTC', year: 'numeric' }), '1969(ji-you)');
 shouldBe(new Date(0).toLocaleString('en', { timeZone: 'UTC', year: 'numeric', calendar: 'chinese' }), '1969(ji-you)');
 
@@ -124,8 +129,8 @@
 // Test for DateTimeFormat behavior.
 // Test that locale parameter is passed through properly.
 shouldThrow(() => new Date().toLocaleTimeString('i'), RangeError);
-shouldBe(new Date(0).toLocaleTimeString('zh-Hans-CN-u-nu-hanidec', { timeZone: 'UTC' }), $vm.icuVersion() >= 69 ? "〇〇:〇〇:〇〇" : "上午一二:〇〇:〇〇");
-shouldBe(new Date(0).toLocaleTimeString('zh-Hans-CN', { timeZone: 'UTC', numberingSystem: 'hanidec' }), $vm.icuVersion() >= 69 ? "〇〇:〇〇:〇〇" : "上午一二:〇〇:〇〇");
+shouldBeOneOf(new Date(0).toLocaleTimeString('zh-Hans-CN-u-nu-hanidec', { timeZone: 'UTC' }), [ "〇〇:〇〇:〇〇", "上午一二:〇〇:〇〇" ]);
+shouldBeOneOf(new Date(0).toLocaleTimeString('zh-Hans-CN', { timeZone: 'UTC', numberingSystem: 'hanidec' }), [ "〇〇:〇〇:〇〇", "上午一二:〇〇:〇〇" ]);
 shouldBe(new Date(0).toLocaleTimeString('en-u-ca-chinese', { timeZone: 'UTC', year: 'numeric' }), '1969(ji-you), 12:00:00 AM');
 shouldBe(new Date(0).toLocaleTimeString('en', { timeZone: 'UTC', year: 'numeric', calendar: 'chinese' }), '1969(ji-you), 12:00:00 AM');
 

Modified: trunk/JSTests/stress/intl-datetimeformat-formatrange-relevant-extensions-ja.js (293444 => 293445)


--- trunk/JSTests/stress/intl-datetimeformat-formatrange-relevant-extensions-ja.js	2022-04-26 19:31:41 UTC (rev 293444)
+++ trunk/JSTests/stress/intl-datetimeformat-formatrange-relevant-extensions-ja.js	2022-04-26 20:01:08 UTC (rev 293445)
@@ -9,7 +9,7 @@
         throw new Error('bad value: ' + actual + ' expected value: ' + expected);
 }
 
-function shouldBeOneOfThem(actual, expectedArray) {
+function shouldBeOneOf(actual, expectedArray) {
     // Tolerate different space characters used by different ICU versions.
     // Older ICU uses U+2009 Thin Space in ranges, whereas newer ICU uses
     // regular old U+0020. Let's ignore these differences.
@@ -71,7 +71,7 @@
         timeZone: 'America/Los_Angeles',
         calendar: 'chinese'
     });
-    shouldBe(fmt2.format(date1), $vm.icuVersion() >= 69 ? `丙戌-11-22 2:00` : `丙戌年11月22日 2:00`);
+    shouldBeOneOf(fmt2.format(date1), [ `丙戌-11-22 2:00`, `丙戌年11月22日 2:00` ]);
     shouldBe(fmt2.formatRange(date1, date2), `丙戌年11月22日 2時00分~3時00分`);
     shouldBe(fmt2.formatRange(date1, date3), `丙戌年11月22日 2:00~丙戌年12月2日 2:00`);
 
@@ -107,11 +107,11 @@
     });
     shouldBe(fmt5.format(date1), `07/1/10 10:00`);
     shouldBe(fmt5.format(date8), `07/1/11 24:00`);
-    shouldBeOneOfThem(fmt5.formatRange(date1, date2), [ `07/1/10 10:00~11:00`, `07/1/10 10時00分~11時00分` ]);
+    shouldBeOneOf(fmt5.formatRange(date1, date2), [ `07/1/10 10:00~11:00`, `07/1/10 10時00分~11時00分` ]);
     shouldBe(fmt5.formatRange(date1, date3), `07/1/10 10:00~07/1/20 10:00`);
-    shouldBeOneOfThem(fmt5.formatRange(date1, date5), [ `07/1/10 10:00~12:00`, `07/1/10 10時00分~12時00分` ]);
-    shouldBeOneOfThem(fmt5.formatRange(date1, date6), [ `07/1/10 10:00~14:00`, `07/1/10 10時00分~14時00分` ]);
-    shouldBeOneOfThem(fmt5.formatRange(date1, date7), [ `07/1/10 10:00~23:00`, `07/1/10 10時00分~23時00分` ]);
+    shouldBeOneOf(fmt5.formatRange(date1, date5), [ `07/1/10 10:00~12:00`, `07/1/10 10時00分~12時00分` ]);
+    shouldBeOneOf(fmt5.formatRange(date1, date6), [ `07/1/10 10:00~14:00`, `07/1/10 10時00分~14時00分` ]);
+    shouldBeOneOf(fmt5.formatRange(date1, date7), [ `07/1/10 10:00~23:00`, `07/1/10 10時00分~23時00分` ]);
     if ($vm.icuVersion() > 66)
         shouldBe(fmt5.formatRange(date1, date8), `07/1/10 10:00~07/1/11 24:00`);
 
@@ -144,11 +144,11 @@
     });
     shouldBe(fmt7.format(date1), `07/1/10 午前10:00`);
     shouldBe(fmt7.format(date8), `07/1/11 午前0:00`);
-    shouldBeOneOfThem(fmt7.formatRange(date1, date2), [ `07/1/10 午前10:00~午前11:00`, `07/1/10 午前10時00分~11時00分` ]);
-    shouldBeOneOfThem(fmt7.formatRange(date1, date3), [ `07/1/10 午前10:00~07/1/20 午前10:00`, `07/1/10 午前10時00分~午後0時00分` ]);
-    shouldBeOneOfThem(fmt7.formatRange(date1, date5), [ `07/1/10 午前10:00~午後0:00`, `07/1/10 午前10時00分~午後0時00分` ]);
-    shouldBeOneOfThem(fmt7.formatRange(date1, date6), [ `07/1/10 午前10:00~午後2:00`, `07/1/10 午前10時00分~午後2時00分` ]);
-    shouldBeOneOfThem(fmt7.formatRange(date1, date7), [ `07/1/10 午前10:00~午後11:00`, `07/1/10 午前10時00分~午後11時00分` ]);
+    shouldBeOneOf(fmt7.formatRange(date1, date2), [ `07/1/10 午前10:00~午前11:00`, `07/1/10 午前10時00分~11時00分` ]);
+    shouldBeOneOf(fmt7.formatRange(date1, date3), [ `07/1/10 午前10:00~07/1/20 午前10:00`, `07/1/10 午前10時00分~午後0時00分` ]);
+    shouldBeOneOf(fmt7.formatRange(date1, date5), [ `07/1/10 午前10:00~午後0:00`, `07/1/10 午前10時00分~午後0時00分` ]);
+    shouldBeOneOf(fmt7.formatRange(date1, date6), [ `07/1/10 午前10:00~午後2:00`, `07/1/10 午前10時00分~午後2時00分` ]);
+    shouldBeOneOf(fmt7.formatRange(date1, date7), [ `07/1/10 午前10:00~午後11:00`, `07/1/10 午前10時00分~午後11時00分` ]);
     shouldBe(fmt7.formatRange(date1, date8), `07/1/10 午前10:00~07/1/11 午前0:00`);
 
     let fmt8 = new Intl.DateTimeFormat("ja", {
@@ -182,11 +182,11 @@
     });
     shouldBe(fmt9.format(date1), `07/1/10 10:00`);
     shouldBe(fmt9.format(date8), `07/1/11 24:00`);
-    shouldBeOneOfThem(fmt9.formatRange(date1, date2), [ `07/1/10 10:00~11:00`, `07/1/10 10時00分~11時00分` ]);
+    shouldBeOneOf(fmt9.formatRange(date1, date2), [ `07/1/10 10:00~11:00`, `07/1/10 10時00分~11時00分` ]);
     shouldBe(fmt9.formatRange(date1, date3), `07/1/10 10:00~07/1/20 10:00`);
-    shouldBeOneOfThem(fmt9.formatRange(date1, date5), [ `07/1/10 10:00~12:00`, `07/1/10 10時00分~12時00分` ]);
-    shouldBeOneOfThem(fmt9.formatRange(date1, date6), [ `07/1/10 10:00~14:00`, `07/1/10 10時00分~14時00分` ]);
-    shouldBeOneOfThem(fmt9.formatRange(date1, date7), [ `07/1/10 10:00~23:00`, `07/1/10 10時00分~23時00分` ]);
+    shouldBeOneOf(fmt9.formatRange(date1, date5), [ `07/1/10 10:00~12:00`, `07/1/10 10時00分~12時00分` ]);
+    shouldBeOneOf(fmt9.formatRange(date1, date6), [ `07/1/10 10:00~14:00`, `07/1/10 10時00分~14時00分` ]);
+    shouldBeOneOf(fmt9.formatRange(date1, date7), [ `07/1/10 10:00~23:00`, `07/1/10 10時00分~23時00分` ]);
     if ($vm.icuVersion() > 66)
         shouldBe(fmt9.formatRange(date1, date8), `07/1/10 10:00~07/1/11 24:00`);
 
@@ -219,11 +219,11 @@
     });
     shouldBe(fmt11.format(date1), `07/1/10 午前10:00`);
     shouldBe(fmt11.format(date8), `07/1/11 午前00:00`);
-    shouldBeOneOfThem(fmt11.formatRange(date1, date2), [ `07/1/10 午前10:00~午前11:00`, `07/1/10 午前10時00分~11時00分` ]);
+    shouldBeOneOf(fmt11.formatRange(date1, date2), [ `07/1/10 午前10:00~午前11:00`, `07/1/10 午前10時00分~11時00分` ]);
     shouldBe(fmt11.formatRange(date1, date3), `07/1/10 午前10:00~07/1/20 午前10:00`);
-    shouldBeOneOfThem(fmt11.formatRange(date1, date5), [ `07/1/10 午前10:00~午後0:00`, `07/1/10 午前10時00分~午後0時00分` ]);
-    shouldBeOneOfThem(fmt11.formatRange(date1, date6), [ `07/1/10 午前10:00~午後2:00`, `07/1/10 午前10時00分~午後2時00分` ]);
-    shouldBeOneOfThem(fmt11.formatRange(date1, date7), [ `07/1/10 午前10:00~午後11:00`, `07/1/10 午前10時00分~午後11時00分` ]);
+    shouldBeOneOf(fmt11.formatRange(date1, date5), [ `07/1/10 午前10:00~午後0:00`, `07/1/10 午前10時00分~午後0時00分` ]);
+    shouldBeOneOf(fmt11.formatRange(date1, date6), [ `07/1/10 午前10:00~午後2:00`, `07/1/10 午前10時00分~午後2時00分` ]);
+    shouldBeOneOf(fmt11.formatRange(date1, date7), [ `07/1/10 午前10:00~午後11:00`, `07/1/10 午前10時00分~午後11時00分` ]);
     shouldBe(fmt11.formatRange(date1, date8), `07/1/10 午前10:00~07/1/11 午前0:00`);
 
     let fmt12 = new Intl.DateTimeFormat("ja", {
@@ -258,11 +258,11 @@
     });
     shouldBe(fmt13.format(date1), `07/1/10 午前10:00`);
     shouldBe(fmt13.format(date8), `07/1/11 午前00:00`);
-    shouldBeOneOfThem(fmt13.formatRange(date1, date2), [ `07/1/10 午前10:00~午前11:00`, `07/1/10 午前10時00分~11時00分` ]);
+    shouldBeOneOf(fmt13.formatRange(date1, date2), [ `07/1/10 午前10:00~午前11:00`, `07/1/10 午前10時00分~11時00分` ]);
     shouldBe(fmt13.formatRange(date1, date3), `07/1/10 午前10:00~07/1/20 午前10:00`);
-    shouldBeOneOfThem(fmt13.formatRange(date1, date5), [ `07/1/10 午前10:00~午後0:00`, `07/1/10 午前10時00分~午後0時00分` ]);
-    shouldBeOneOfThem(fmt13.formatRange(date1, date6), [ `07/1/10 午前10:00~午後2:00`, `07/1/10 午前10時00分~午後2時00分` ]);
-    shouldBeOneOfThem(fmt13.formatRange(date1, date7), [ `07/1/10 午前10:00~午後11:00`, `07/1/10 午前10時00分~午後11時00分` ]);
+    shouldBeOneOf(fmt13.formatRange(date1, date5), [ `07/1/10 午前10:00~午後0:00`, `07/1/10 午前10時00分~午後0時00分` ]);
+    shouldBeOneOf(fmt13.formatRange(date1, date6), [ `07/1/10 午前10:00~午後2:00`, `07/1/10 午前10時00分~午後2時00分` ]);
+    shouldBeOneOf(fmt13.formatRange(date1, date7), [ `07/1/10 午前10:00~午後11:00`, `07/1/10 午前10時00分~午後11時00分` ]);
     shouldBe(fmt13.formatRange(date1, date8), `07/1/10 午前10:00~07/1/11 午前0:00`);
 
     let fmt14 = new Intl.DateTimeFormat("ja", {
@@ -277,11 +277,11 @@
     });
     shouldBe(fmt14.format(date1), `07/1/10 午前10:00`);
     shouldBe(fmt14.format(date8), `07/1/11 午前00:00`);
-    shouldBeOneOfThem(fmt14.formatRange(date1, date2), [ `07/1/10 午前10:00~午前11:00`, `07/1/10 午前10時00分~11時00分` ]);
+    shouldBeOneOf(fmt14.formatRange(date1, date2), [ `07/1/10 午前10:00~午前11:00`, `07/1/10 午前10時00分~11時00分` ]);
     shouldBe(fmt14.formatRange(date1, date3), `07/1/10 午前10:00~07/1/20 午前10:00`);
-    shouldBeOneOfThem(fmt14.formatRange(date1, date5), [ `07/1/10 午前10:00~午後0:00`, `07/1/10 午前10時00分~午後0時00分` ]);
-    shouldBeOneOfThem(fmt14.formatRange(date1, date6), [ `07/1/10 午前10:00~午後2:00`, `07/1/10 午前10時00分~午後2時00分` ]);
-    shouldBeOneOfThem(fmt14.formatRange(date1, date7), [ `07/1/10 午前10:00~午後11:00`, `07/1/10 午前10時00分~午後11時00分` ]);
+    shouldBeOneOf(fmt14.formatRange(date1, date5), [ `07/1/10 午前10:00~午後0:00`, `07/1/10 午前10時00分~午後0時00分` ]);
+    shouldBeOneOf(fmt14.formatRange(date1, date6), [ `07/1/10 午前10:00~午後2:00`, `07/1/10 午前10時00分~午後2時00分` ]);
+    shouldBeOneOf(fmt14.formatRange(date1, date7), [ `07/1/10 午前10:00~午後11:00`, `07/1/10 午前10時00分~午後11時00分` ]);
     shouldBe(fmt14.formatRange(date1, date8), `07/1/10 午前10:00~07/1/11 午前0:00`);
 
     let fmt15 = new Intl.DateTimeFormat("ja", {
@@ -296,11 +296,11 @@
     });
     shouldBe(fmt15.format(date1), `07/1/10 午前10:00`);
     shouldBe(fmt15.format(date8), `07/1/11 午前00:00`);
-    shouldBeOneOfThem(fmt15.formatRange(date1, date2), [ `07/1/10 午前10:00~午前11:00`, `07/1/10 午前10時00分~11時00分` ]);
+    shouldBeOneOf(fmt15.formatRange(date1, date2), [ `07/1/10 午前10:00~午前11:00`, `07/1/10 午前10時00分~11時00分` ]);
     shouldBe(fmt15.formatRange(date1, date3), `07/1/10 午前10:00~07/1/20 午前10:00`);
-    shouldBeOneOfThem(fmt15.formatRange(date1, date5), [ `07/1/10 午前10:00~午後0:00`, `07/1/10 午前10時00分~午後0時00分` ]);
-    shouldBeOneOfThem(fmt15.formatRange(date1, date6), [ `07/1/10 午前10:00~午後2:00`, `07/1/10 午前10時00分~午後2時00分` ]);
-    shouldBeOneOfThem(fmt15.formatRange(date1, date7), [ `07/1/10 午前10:00~午後11:00`, `07/1/10 午前10時00分~午後11時00分` ]);
+    shouldBeOneOf(fmt15.formatRange(date1, date5), [ `07/1/10 午前10:00~午後0:00`, `07/1/10 午前10時00分~午後0時00分` ]);
+    shouldBeOneOf(fmt15.formatRange(date1, date6), [ `07/1/10 午前10:00~午後2:00`, `07/1/10 午前10時00分~午後2時00分` ]);
+    shouldBeOneOf(fmt15.formatRange(date1, date7), [ `07/1/10 午前10:00~午後11:00`, `07/1/10 午前10時00分~午後11時00分` ]);
     shouldBe(fmt15.formatRange(date1, date8), `07/1/10 午前10:00~07/1/11 午前0:00`);
 
     let fmt16 = new Intl.DateTimeFormat("ja", {
@@ -315,10 +315,10 @@
     });
     shouldBe(fmt16.format(date1), `07/1/10 午前10:00`);
     shouldBe(fmt16.format(date8), `07/1/11 午前00:00`);
-    shouldBeOneOfThem(fmt16.formatRange(date1, date2), [ `07/1/10 午前10:00~午前11:00`, `07/1/10 午前10時00分~11時00分` ]);
+    shouldBeOneOf(fmt16.formatRange(date1, date2), [ `07/1/10 午前10:00~午前11:00`, `07/1/10 午前10時00分~11時00分` ]);
     shouldBe(fmt16.formatRange(date1, date3), `07/1/10 午前10:00~07/1/20 午前10:00`);
-    shouldBeOneOfThem(fmt16.formatRange(date1, date5), [ `07/1/10 午前10:00~午後0:00`, `07/1/10 午前10時00分~午後0時00分` ]);
-    shouldBeOneOfThem(fmt16.formatRange(date1, date6), [ `07/1/10 午前10:00~午後2:00`, `07/1/10 午前10時00分~午後2時00分` ]);
-    shouldBeOneOfThem(fmt16.formatRange(date1, date7), [ `07/1/10 午前10:00~午後11:00`, `07/1/10 午前10時00分~午後11時00分` ]);
+    shouldBeOneOf(fmt16.formatRange(date1, date5), [ `07/1/10 午前10:00~午後0:00`, `07/1/10 午前10時00分~午後0時00分` ]);
+    shouldBeOneOf(fmt16.formatRange(date1, date6), [ `07/1/10 午前10:00~午後2:00`, `07/1/10 午前10時00分~午後2時00分` ]);
+    shouldBeOneOf(fmt16.formatRange(date1, date7), [ `07/1/10 午前10:00~午後11:00`, `07/1/10 午前10時00分~午後11時00分` ]);
     shouldBe(fmt16.formatRange(date1, date8), `07/1/10 午前10:00~07/1/11 午前0:00`);
 }

Modified: trunk/JSTests/stress/intl-datetimeformat-formatrangetoparts-relevant-extensions-ja.js (293444 => 293445)


--- trunk/JSTests/stress/intl-datetimeformat-formatrangetoparts-relevant-extensions-ja.js	2022-04-26 19:31:41 UTC (rev 293444)
+++ trunk/JSTests/stress/intl-datetimeformat-formatrangetoparts-relevant-extensions-ja.js	2022-04-26 20:01:08 UTC (rev 293445)
@@ -13,6 +13,12 @@
         throw new Error('bad value: ' + actual + ' expected value: ' + expected);
 }
 
+function shouldBeOneOf(actual, expectedArray) {
+    actual = normalize(actual);
+    if (!expectedArray.some((value) => value === actual))
+        throw new Error('bad value: ' + actual + ' expected values: ' + expectedArray);
+}
+
 function compareParts(actual, expected) {
     if (actual.length !== expected.length)
         return false;
@@ -133,7 +139,7 @@
         timeZone: 'America/Los_Angeles',
         calendar: 'chinese'
     });
-    shouldBe(fmt2.format(date1), $vm.icuVersion() >= 69 ? `丙戌-11-22 2:00` : `丙戌年11月22日 2:00`);
+    shouldBeOneOf(fmt2.format(date1), [ `丙戌-11-22 2:00`, `丙戌年11月22日 2:00` ]);
     shouldBeParts(fmt2.formatRangeToParts(date1, date2), [
         {"type":"yearName","value":"丙戌","source":"shared"},
         {"type":"literal","value":"年","source":"shared"},

Modified: trunk/JSTests/stress/intl-datetimeformat.js (293444 => 293445)


--- trunk/JSTests/stress/intl-datetimeformat.js	2022-04-26 19:31:41 UTC (rev 293444)
+++ trunk/JSTests/stress/intl-datetimeformat.js	2022-04-26 20:01:08 UTC (rev 293445)
@@ -3,13 +3,7 @@
         throw new Error(`expected ${expected} but got ${actual}`);
 }
 
-function shouldBeOneOfThem(actual, expectedArray) {
-    // Tolerate different space characters used by different ICU versions.
-    // Older ICU uses U+2009 Thin Space in ranges, whereas newer ICU uses
-    // regular old U+0020. Let's ignore these differences.
-    if (typeof actual === 'string')
-        actual = actual.replaceAll(' ', ' ');
-
+function shouldBeOneOf(actual, expectedArray) {
     if (!expectedArray.some((value) => value === actual))
         throw new Error('bad value: ' + actual + ' expected values: ' + expectedArray);
 }
@@ -344,7 +338,7 @@
 shouldBe(Intl.DateTimeFormat('en-u-ca-islamic', { timeZone: 'America/Los_Angeles' }).format(1451099872641), '3/14/1437 AH');
 shouldBe(Intl.DateTimeFormat('en-u-ca-islamicc', { timeZone: 'America/Los_Angeles' }).format(1451099872641), '3/13/1437 AH');
 shouldBe(Intl.DateTimeFormat('en-u-ca-ISO8601', { timeZone: 'America/Los_Angeles' }).format(1451099872641), '12/25/2015');
-shouldBeOneOfThem(Intl.DateTimeFormat('en-u-ca-japanese', { timeZone: 'America/Los_Angeles' }).format(1451099872641), [ '12/25/27 H', '12/25/H27' ]);
+shouldBeOneOf(Intl.DateTimeFormat('en-u-ca-japanese', { timeZone: 'America/Los_Angeles' }).format(1451099872641), [ '12/25/27 H', '12/25/H27' ]);
 shouldBe(Intl.DateTimeFormat('en-u-ca-persian', { timeZone: 'America/Los_Angeles' }).format(1451099872641), '10/4/1394 AP');
 shouldBe(Intl.DateTimeFormat('en-u-ca-roc', { timeZone: 'America/Los_Angeles' }).format(1451099872641), '12/25/104 Minguo');
 shouldBeForICUVersion(62, Intl.DateTimeFormat('en-u-ca-ethiopic-amete-alem', { timeZone: 'America/Los_Angeles' }).format(1451099872641), '4/15/7508 ERA0');
@@ -763,7 +757,7 @@
     shouldBe(JSON.stringify(actual), JSON.stringify(expected));
 }
 {
-    shouldBe(new Date(0).toLocaleTimeString('zh-Hans-CN', { timeZone: 'UTC', numberingSystem: 'hanidec', hour: "numeric", minute: "numeric", second: "numeric", fractionalSecondDigits: 2 }), $vm.icuVersion() >= 69 ? "〇〇:〇〇:〇〇.〇〇" : "上午一二:〇〇:〇〇.〇〇");
+    shouldBeOneOf(new Date(0).toLocaleTimeString('zh-Hans-CN', { timeZone: 'UTC', numberingSystem: 'hanidec', hour: "numeric", minute: "numeric", second: "numeric", fractionalSecondDigits: 2 }), [ "〇〇:〇〇:〇〇.〇〇", "上午一二:〇〇:〇〇.〇〇" ]);
 }
 {
     const dtf = new Intl.DateTimeFormat('en-AU', { timeZone: 'Australia/Melbourne', year: 'numeric' });

Modified: trunk/JSTests/stress/intl-locale-info.js (293444 => 293445)


--- trunk/JSTests/stress/intl-locale-info.js	2022-04-26 19:31:41 UTC (rev 293444)
+++ trunk/JSTests/stress/intl-locale-info.js	2022-04-26 20:01:08 UTC (rev 293445)
@@ -3,6 +3,11 @@
         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);
+}
+
 {
     let he = new Intl.Locale("he")
     shouldBe(JSON.stringify(he.weekInfo), `{"firstDay":7,"weekend":[5,6],"minimalDays":1}`);
@@ -88,7 +93,7 @@
     shouldBe(JSON.stringify(locale.calendars), `["gregory","chinese"]`);
     shouldBe(JSON.stringify(locale.collations), `["pinyin","big5han","gb2312","stroke","unihan","zhuyin","emoji","eor"]`);
     shouldBe(locale.hourCycle, undefined);
-    shouldBe(JSON.stringify(locale.hourCycles), $vm.icuVersion() >= 69 ? `["h23"]` : `["h12"]`);
+    shouldBeOneOf(JSON.stringify(locale.hourCycles), [ `["h23"]`, `["h12"]` ]);
     shouldBe(JSON.stringify(locale.numberingSystems), `["latn"]`);
     shouldBe(locale.timeZones, undefined);
 }

Modified: trunk/JSTests/stress/intl-locale.js (293444 => 293445)


--- trunk/JSTests/stress/intl-locale.js	2022-04-26 19:31:41 UTC (rev 293444)
+++ trunk/JSTests/stress/intl-locale.js	2022-04-26 20:01:08 UTC (rev 293445)
@@ -3,6 +3,11 @@
         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();
 }
@@ -152,7 +157,7 @@
         ? 'en-Latn-US-1abc-foobar-variant-a-aa-aaa-u-kn-x-reserved'
         : 'en-Latn-US-variant-foobar-1abc-a-aa-aaa-u-kn-x-reserved'
 );
-shouldBe(new Intl.Locale('cel-gaulish', { script: 'Arab', numberingSystem: 'gujr' }).toString(), $vm.icuVersion() >= 69 ? 'xtg-Arab-u-nu-gujr' : 'xtg-Arab-u-nu-gujr-x-cel-gaulish');
+shouldBeOneOf(new Intl.Locale('cel-gaulish', { script: 'Arab', numberingSystem: 'gujr' }).toString(), [ 'xtg-Arab-u-nu-gujr', 'xtg-Arab-u-nu-gujr-x-cel-gaulish', 'cel-Arab-gaulish-u-nu-gujr' ]);
 shouldBe(new Intl.Locale('en-Latn-US-u-ca-gregory-co-phonebk-hc-h12-kf-upper-kn-false-nu-latn').toString(), 'en-Latn-US-u-ca-gregory-co-phonebk-hc-h12-kf-upper-kn-false-nu-latn');
 
 const options = {
@@ -229,7 +234,7 @@
 
 shouldBe(new Intl.Locale('en-Latn-US').language, 'en');
 shouldBe(new Intl.Locale('en', { language: 'ar' }).language, 'ar');
-shouldBe(new Intl.Locale('cel-gaulish').language, 'xtg');
+shouldBeOneOf(new Intl.Locale('cel-gaulish').language, [ 'xtg', 'cel' ]);
 shouldThrow(() => new Intl.Locale('en', { language: { toString() { throw new Error(); } } }), Error);
 shouldThrow(() => new Intl.Locale('en', { language: 'fail' }), RangeError);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to