Title: [292481] trunk/JSTests
Revision
292481
Author
shvaikal...@gmail.com
Date
2022-04-06 11:21:47 -0700 (Wed, 06 Apr 2022)

Log Message

ICU was recently updated to use type="long" format if there is {month: "long"}
https://bugs.webkit.org/show_bug.cgi?id=238852
<rdar://90462186>

Reviewed by Saam Barati.

Since this update [1] is not yet released, we can't set expectations based on major / minor
ICU version, this patch loosens the tests to accept either of the format types.

[1]: https://github.com/unicode-org/icu/commit/23081486ffec0973b01e66e2cbad93a1a7dec267

* stress/date-toLocaleString.js:
* stress/intl-datetimeformat.js:

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (292480 => 292481)


--- trunk/JSTests/ChangeLog	2022-04-06 18:20:48 UTC (rev 292480)
+++ trunk/JSTests/ChangeLog	2022-04-06 18:21:47 UTC (rev 292481)
@@ -1,3 +1,19 @@
+2022-04-06  Alexey Shvayka  <ashva...@apple.com>
+
+        ICU was recently updated to use type="long" format if there is {month: "long"}
+        https://bugs.webkit.org/show_bug.cgi?id=238852
+        <rdar://90462186>
+
+        Reviewed by Saam Barati.
+
+        Since this update [1] is not yet released, we can't set expectations based on major / minor
+        ICU version, this patch loosens the tests to accept either of the format types.
+
+        [1]: https://github.com/unicode-org/icu/commit/23081486ffec0973b01e66e2cbad93a1a7dec267
+
+        * stress/date-toLocaleString.js:
+        * stress/intl-datetimeformat.js:
+
 2022-04-01  Angelos Oikonomopoulos  <ange...@igalia.com>
 
         Skip flaky test on mips

Modified: trunk/JSTests/stress/date-toLocaleString.js (292480 => 292481)


--- trunk/JSTests/stress/date-toLocaleString.js	2022-04-06 18:20:48 UTC (rev 292480)
+++ trunk/JSTests/stress/date-toLocaleString.js	2022-04-06 18:21:47 UTC (rev 292481)
@@ -137,4 +137,8 @@
 // If time formats specifed, just use them.
 shouldBe(new Date(0).toLocaleTimeString('en', { timeZone: 'UTC', hour: 'numeric', minute: '2-digit' }), '12:00 AM');
 // Adds hms if no time formats specified.
-shouldBe(new Date(0).toLocaleTimeString('en', { timeZone: 'UTC', year: 'numeric', month: 'long' }), 'January 1970, 12:00:00 AM');
+// See https://bugs.webkit.org/show_bug.cgi?id=238852
+const monthLongTimeString = new Date(0).toLocaleTimeString('en', { timeZone: 'UTC', year: 'numeric', month: 'long' });
+if (monthLongTimeString !== 'January 1970, 12:00:00 AM' &&
+    monthLongTimeString !== 'January 1970 at 12:00:00 AM')
+    throw new Error(`Unexpected time string for {month: 'long'}: ${monthLongTimeString}`);

Modified: trunk/JSTests/stress/intl-datetimeformat.js (292480 => 292481)


--- trunk/JSTests/stress/intl-datetimeformat.js	2022-04-06 18:20:48 UTC (rev 292480)
+++ trunk/JSTests/stress/intl-datetimeformat.js	2022-04-06 18:21:47 UTC (rev 292481)
@@ -636,7 +636,7 @@
 }
 
 // Exceed the 32 character default buffer size
-shouldBe(
+const actualMonthLongParts =
     JSON.stringify(
         Intl.DateTimeFormat('en-US', {
             hour: 'numeric', minute: 'numeric', second: 'numeric',
@@ -643,7 +643,9 @@
             year: 'numeric', month: 'long', day: 'numeric', weekday: 'long',
             timeZoneName: 'long', era: 'long', timeZone: 'America/Los_Angeles'
         }).formatToParts(0)
-    ),
+    );
+
+const getExpectedMonthLongParts = separator => (
     JSON.stringify([
         { type: 'weekday', value: 'Wednesday' },
         { type: 'literal', value: ', ' },
@@ -654,7 +656,7 @@
         { type: 'year', value: '1969' },
         { type: 'literal', value: ' ' },
         { type: 'era', value: 'Anno Domini' },
-        { type: 'literal', value: ', ' },
+        { type: 'literal', value: separator },
         { type: 'hour', value: '4' },
         { type: 'literal', value: ':' },
         { type: 'minute', value: '00' },
@@ -667,6 +669,10 @@
     ])
 );
 
+// See https://bugs.webkit.org/show_bug.cgi?id=238852
+if (actualMonthLongParts !== getExpectedMonthLongParts(', ') && actualMonthLongParts !== getExpectedMonthLongParts(' at '))
+    throw new Error(`Unexpected format parts for {month: 'long'}: ${actualMonthLongParts}`);
+
 // Tests for relativeYear and yearName
 const parts = JSON.stringify([
     { type: 'relatedYear', value: '1969' },
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to