v8/test/intl/relative-time-format/resolved-options-nu.js
Frank Tang 9732200408 Reland test part of "[Intl] Cleans up intl-relative-time-format flag"
This is a partial reland of 048a3a3ecb

Original change's description:
> [Intl] Cleans up intl-relative-time-format flag
>
> Cleans up always=true intl-relative-time-format flag
> It shipped in m71 in Dec 2018.
>
> Bug: v8:8704
> Change-Id: I52d86aea9aedf201a216a1df0773a486fbee37b9
> Reviewed-on: https://chromium-review.googlesource.com/c/1417299
> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#58904}

Bug: v8:8704
Change-Id: Iac62a347eea7f85dd3fa4a3bbfb18091b80f9a5e
Reviewed-on: https://chromium-review.googlesource.com/c/1429224
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59081}
2019-01-24 23:17:35 +00:00

96 lines
2.5 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
);
assertEquals(
"beng",
new Intl.RelativeTimeFormat("bn").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
);
assertEquals(
"latn",
new Intl.RelativeTimeFormat("bn-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
);
assertEquals(
"beng",
new Intl.RelativeTimeFormat("bn-u-nu-abcd").resolvedOptions()
.numberingSystem
);