Reland "Add regression tests for 4 calendar bugs"

This is a reland of 915f729afb

Original change's description:
> Add regression tests for 4 calendar bugs
>
> These bugs was fixed by ICU68
>
> Bug: v8:10526, v8:10527, v8:10528, v8:10529
> Change-Id: I8d0dcb52d849f742e0a29314ac8a148370f60a1a
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2527086
> Reviewed-by: Shu-yu Guo <syg@chromium.org>
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#71062}

Cq-Include-Trybots: luci.v8.try:v8_android_arm64_n5x_rel_ng
Bug: v8:10526
Bug: v8:10527
Bug: v8:10528
Bug: v8:10529
Change-Id: I8857fb8c104bb4bede8fe816574bfd46ccbcd082
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2536737
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71244}
This commit is contained in:
Frank Tang 2020-11-17 15:08:00 -08:00 committed by Commit Bot
parent 0db6d4426a
commit f6d2255a03
4 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,21 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Test date format in islamic-umalqura calendar of date prior to
// -195366-07-23
// On Android, islamic-umalqura calendar is only available on ar and fa locales.
let dateOK = new Date (Date.UTC(-195366, 6, 23));
let dateKO = new Date (Date.UTC(-195366, 6, 22));
let dateDisplay = new Intl.DateTimeFormat (
'ar-u-ca-islamic-umalqura',
{ timeZone : 'UTC', year : 'numeric', month :'long',
day : 'numeric', weekday : 'long' });
assertEquals("Wed, 23 Jul -195366 00:00:00 GMT",
dateOK.toUTCString(), "dateOK.toUTCString()");
assertEquals("Tue, 22 Jul -195366 00:00:00 GMT",
dateKO.toUTCString(), "dateKO.toUTCString()");
assertEquals("الأربعاء، 17 ذو الحجة -202003 هـ",
dateDisplay.format(dateOK), "dateDisplay.format(dateOK)");
assertEquals("الثلاثاء، 16 ذو الحجة -202003 هـ",
dateDisplay.format(dateKO), "dateDisplay.format(dateKO)");

View File

@ -0,0 +1,30 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Test date format in Islamic and Islamic-rgsa calendars of dates prior
// to 0622-07-18
// On Android, islamic and islamic-rgsac calendar are only available on ar
// and fa locales.
let dateOK = new Date (Date.UTC(622, 6, 18));
let dateKO = new Date (Date.UTC(622, 6, 17));
let dateDisplay = new Intl.DateTimeFormat (
'ar-u-ca-islamic',
{ timeZone : 'UTC', year : 'numeric', month :'long',
day : 'numeric', weekday : 'long' });
let dateDisplay2 = new Intl.DateTimeFormat (
'ar-u-ca-islamic-rgsa',
{ timeZone : 'UTC', year : 'numeric', month :'long',
day : 'numeric', weekday : 'long' });
assertEquals("Thu, 18 Jul 0622 00:00:00 GMT",
dateOK.toUTCString(), "dateOK.toUTCString()");
assertEquals("Wed, 17 Jul 0622 00:00:00 GMT",
dateKO.toUTCString(), "dateKO.toUTCString()");
assertEquals("الخميس، 1 محرم 1 هـ",
dateDisplay.format(dateOK), "dateDisplay.format(dateOK)");
assertEquals("الأربعاء، 30 ذو الحجة 0 هـ",
dateDisplay.format(dateKO), "dateDisplay.format(dateKO)");
assertEquals("الخميس، 1 محرم 1 هـ",
dateDisplay2.format(dateOK), "dateDisplay.format(dateOK)");
assertEquals("الأربعاء، 30 ذو الحجة 0 هـ",
dateDisplay2.format(dateKO), "dateDisplay.format(dateKO)");

View File

@ -0,0 +1,20 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Test date format in Hebrew calendar of dates prior to -003760-09-07
// On Android, hebrew calendar is only available on he locale.
let dateOK = new Date (Date.UTC(-3760, 8, 7));
let dateKO = new Date (Date.UTC(-3760, 8, 6));
let dateDisplay = new Intl.DateTimeFormat (
'he-u-ca-hebrew',
{ timeZone : 'UTC', year : 'numeric', month :'long',
day : 'numeric', weekday : 'long' });
assertEquals("Mon, 07 Sep -3760 00:00:00 GMT",
dateOK.toUTCString(), "dateOK.toUTCString()");
assertEquals("Sun, 06 Sep -3760 00:00:00 GMT",
dateKO.toUTCString(), "dateKO.toUTCString()");
assertEquals("יום שני, 1 בתשרי 1",
dateDisplay.format(dateOK), "dateDisplay.format(dateOK)");
assertEquals("יום ראשון, 29 באלול 0",
dateDisplay.format(dateKO), "dateDisplay.format(dateKO)");

View File

@ -0,0 +1,20 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Test date format in Indian calendar of date prior to 0001-01-01
// On Android, indian calendar is only available on hi locale.
let dateOK = new Date ("0001-12-31T23:52:58.000Z");
let dateKO = new Date ("0000-12-30T23:52:58.000Z");
let dateDisplay = new Intl.DateTimeFormat (
'hi-u-ca-indian',
{ timeZone : 'UTC', year : 'numeric', month :'long',
day : 'numeric', weekday : 'long' });
assertEquals("Mon, 31 Dec 0001 23:52:58 GMT",
dateOK.toUTCString(), "dateOK.toUTCString()");
assertEquals("Sat, 30 Dec 0000 23:52:58 GMT",
dateKO.toUTCString(), "dateKO.toUTCString()");
assertEquals("शक -77 पौष 10, सोमवार",
dateDisplay.format(dateOK), "dateDisplay.format(dateOK)");
assertEquals("शक -78 पौष 9, शनिवार",
dateDisplay.format(dateKO), "dateDisplay.format(dateKO)");