v8/test/intl/relative-time-format/resolved-options-nu.js
Frank Tang cde0d18c71 Split out tests of "bn" locale to a different file.
Bug: v8:9110
Change-Id: I834ce91e8c77dc04fa261abb9bd415eb03bf949e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1562732
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60788}
2019-04-11 16:13:52 +00:00

82 lines
2.1 KiB
JavaScript

// Copyright 2018 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.
// For locale default the numberingSystem to 'latn'
assertEquals(
"latn",
new Intl.RelativeTimeFormat("ar").resolvedOptions().numberingSystem
);
assertEquals(
"latn",
new Intl.RelativeTimeFormat("en").resolvedOptions().numberingSystem
);
assertEquals(
"latn",
new Intl.RelativeTimeFormat("fr").resolvedOptions().numberingSystem
);
assertEquals(
"latn",
new Intl.RelativeTimeFormat("hi").resolvedOptions().numberingSystem
);
assertEquals(
"latn",
new Intl.RelativeTimeFormat("th").resolvedOptions().numberingSystem
);
assertEquals(
"latn",
new Intl.RelativeTimeFormat("zh-Hant").resolvedOptions().numberingSystem
);
// For locale default the numberingSystem to other than 'latn'
assertEquals(
"arab",
new Intl.RelativeTimeFormat("ar-TD").resolvedOptions().numberingSystem
);
assertEquals(
"arabext",
new Intl.RelativeTimeFormat("fa").resolvedOptions().numberingSystem
);
// For locale use -u-nu- to change to other numberingSystem
assertEquals(
"thai",
new Intl.RelativeTimeFormat("en-u-nu-thai").resolvedOptions()
.numberingSystem
);
assertEquals(
"arab",
new Intl.RelativeTimeFormat("en-u-nu-arab").resolvedOptions()
.numberingSystem
);
// For locale which default others but use -u-nu-latn to change to 'latn' numberingSystem
assertEquals(
"latn",
new Intl.RelativeTimeFormat("fa-u-nu-latn").resolvedOptions()
.numberingSystem
);
assertEquals(
"latn",
new Intl.RelativeTimeFormat("ar-TD-u-nu-latn").resolvedOptions()
.numberingSystem
);
assertEquals(
"latn",
new Intl.RelativeTimeFormat("fa-u-nu-latn").resolvedOptions()
.numberingSystem
);
// For locale use -u-nu- with invalid value still back to default.
assertEquals(
"latn",
new Intl.RelativeTimeFormat("en-u-nu-abcd").resolvedOptions()
.numberingSystem
);
assertEquals(
"arabext",
new Intl.RelativeTimeFormat("fa-u-nu-abcd").resolvedOptions()
.numberingSystem
);