Changeset 292481 in webkit


Ignore:
Timestamp:
Apr 6, 2022 11:21:47 AM (2 years ago)
Author:
Alexey Shvayka
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:
Location:
trunk/JSTests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r292217 r292481  
     12022-04-06  Alexey Shvayka  <ashvayka@apple.com>
     2
     3        ICU was recently updated to use type="long" format if there is {month: "long"}
     4        https://bugs.webkit.org/show_bug.cgi?id=238852
     5        <rdar://90462186>
     6
     7        Reviewed by Saam Barati.
     8
     9        Since this update [1] is not yet released, we can't set expectations based on major / minor
     10        ICU version, this patch loosens the tests to accept either of the format types.
     11
     12        [1]: https://github.com/unicode-org/icu/commit/23081486ffec0973b01e66e2cbad93a1a7dec267
     13
     14        * stress/date-toLocaleString.js:
     15        * stress/intl-datetimeformat.js:
     16
    1172022-04-01  Angelos Oikonomopoulos  <angelos@igalia.com>
    218
  • trunk/JSTests/stress/date-toLocaleString.js

    r286998 r292481  
    138138shouldBe(new Date(0).toLocaleTimeString('en', { timeZone: 'UTC', hour: 'numeric', minute: '2-digit' }), '12:00 AM');
    139139// Adds hms if no time formats specified.
    140 shouldBe(new Date(0).toLocaleTimeString('en', { timeZone: 'UTC', year: 'numeric', month: 'long' }), 'January 1970, 12:00:00 AM');
     140// See https://bugs.webkit.org/show_bug.cgi?id=238852
     141const monthLongTimeString = new Date(0).toLocaleTimeString('en', { timeZone: 'UTC', year: 'numeric', month: 'long' });
     142if (monthLongTimeString !== 'January 1970, 12:00:00 AM' &&
     143    monthLongTimeString !== 'January 1970 at 12:00:00 AM')
     144    throw new Error(`Unexpected time string for {month: 'long'}: ${monthLongTimeString}`);
  • trunk/JSTests/stress/intl-datetimeformat.js

    r286998 r292481  
    637637
    638638// Exceed the 32 character default buffer size
    639 shouldBe(
     639const actualMonthLongParts =
    640640    JSON.stringify(
    641641        Intl.DateTimeFormat('en-US', {
     
    644644            timeZoneName: 'long', era: 'long', timeZone: 'America/Los_Angeles'
    645645        }).formatToParts(0)
    646     ),
     646    );
     647
     648const getExpectedMonthLongParts = separator => (
    647649    JSON.stringify([
    648650        { type: 'weekday', value: 'Wednesday' },
     
    655657        { type: 'literal', value: ' ' },
    656658        { type: 'era', value: 'Anno Domini' },
    657         { type: 'literal', value: ', ' },
     659        { type: 'literal', value: separator },
    658660        { type: 'hour', value: '4' },
    659661        { type: 'literal', value: ':' },
     
    667669    ])
    668670);
     671
     672// See https://bugs.webkit.org/show_bug.cgi?id=238852
     673if (actualMonthLongParts !== getExpectedMonthLongParts(', ') && actualMonthLongParts !== getExpectedMonthLongParts(' at '))
     674    throw new Error(`Unexpected format parts for {month: 'long'}: ${actualMonthLongParts}`);
    669675
    670676// Tests for relativeYear and yearName
Note: See TracChangeset for help on using the changeset viewer.