v8/test/intl/regress-10599.js
Frank Tang 6680837c8a Roll icu to fix sr-ME timeZoneName in Latin bug
Bug: v8:10599
Change-Id: I1248d365576c0bc8c01d8ce07f0c49654fabfc52
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2251173
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68422}
2020-06-19 06:42:51 +00:00

36 lines
1.6 KiB
JavaScript

// 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 in sr-ME locale, we consistently use Latin for both month and
// TimeZoneName.
let someCyrillicRE = /\p{Script=Cyrillic}/u;
let someLatinRE = /\p{Script=Latin}/u;
let allLatinRE = /[\s\d\.\p{Script=Latin}]+/u;
let allCyrillicRE = /^[\s\d\.\p{Script=Cyrillic}]+$/u;
let d = new Date();
let srMETimeZone = new Intl.DateTimeFormat("sr-ME",
{timeZoneName: "long", timeZone: "America/Los_Angeles"});
let srMEMonth = new Intl.DateTimeFormat("sr-ME", {month: "long"});
let srTimeZone = new Intl.DateTimeFormat("sr",
{timeZoneName: "long", timeZone: "America/Los_Angeles"});
let srMonth = new Intl.DateTimeFormat("sr", {month: "long"});
let srMETimeZoneString = srMETimeZone.format(d);
let srMEMonthString = srMEMonth.format(d);
let srTimeZoneString = srTimeZone.format(d);
let srMonthString = srMonth.format(d);
// sr-ME should have both in Latin
assertTrue(allLatinRE.test(srMETimeZoneString), srMETimeZoneString);
assertTrue(allLatinRE.test(srMEMonthString), srMEMonthString);
assertFalse(someCyrillicRE.test(srMETimeZoneString), srMETimeZoneString);
assertFalse(someCyrillicRE.test(srMEMonthString), srMEMonthString);
// sr should have both in Cyrillic
assertTrue(allCyrillicRE.test(srTimeZoneString), srTimeZoneString);
assertTrue(allCyrillicRE.test(srMonthString), srMonthString);
assertFalse(someLatinRE.test(srTimeZoneString), srTimeZoneString);
assertFalse(someLatinRE.test(srMonthString), srMonthString);