node/deps/v8/test/intl/regress-10599.js
Michaël Zasso a1d639ba5d
deps: update V8 to 8.6.395
PR-URL: https://github.com/nodejs/node/pull/35415
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2020-10-18 20:16:47 +02: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);