v8/test/intl/regress-1107661.js
Frank Tang be3550bf70 Fix "japanese" and "chinese" calendar
Roll the icu to include the fix. The roll include previously
mistakenly filter out required resources.
Fix "japanese" under "ja" and calendar: "chinese" under "zh"
Depends on https://chromium-review.googlesource.com/c/chromium/deps/icu/+/2433166

This CL prepare for such landing:
1. Add test to show the correct result.
2. Wrap the number format static cast to DecimalFormat only if
   the concrete class is DecimalFormat. This is needed after the landing
   because the new resource enable other subclass of NumberFormat.
3. Change test to allow the additional numberingSystems.

Roll the the DEPS of chromium in
https://chromium-review.googlesource.com/c/chromium/src/+/2437820

Bug: v8:10960
Change-Id: Ib10b11862a093d1d487070f79556505bfc10bcc5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2432801
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70253}
2020-10-01 10:32:42 +00:00

28 lines
1.0 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.
// The following numberingSystems are not supported yet
const algorithmicNumberingSystems = [
"armn", "armnlow", "cyrl", "ethi", "geor", "grek", "greklow", "hans",
"hansfin", "hant", "hantfin", "hebr", "jpan", "jpanfin", "roman", "romanlow",
"taml"
];
algorithmicNumberingSystems.forEach(function(numberingSystem) {
let df = new Intl.DateTimeFormat("en", {dateStyle: "full", numberingSystem});
if (df.resolvedOptions().numberingSystem != numberingSystem) {
assertEquals("latn", df.resolvedOptions().numberingSystem);
}
let df2 = new Intl.DateTimeFormat("en-u-nu-" + numberingSystem,
{dateStyle: "full"});
if (df2.resolvedOptions().numberingSystem != numberingSystem) {
assertEquals("latn", df2.resolvedOptions().numberingSystem);
}
// Just verify it won't crash
(new Date()).toLocaleString("en-u-nu-" + numberingSystem, {dateStyle: "full"});
});