v8/test/intl/list-format/resolved-options.js
Frank Tang 6ee9ec5ca1 [Intl] Remove --harmony-intl-list-format flag from test
This is part 1 of 2 of clean up. C++ change in Part 2 next.

Bug: v8:8705
Change-Id: Ibf4425c141391581b963f4775286b65b652452e2
Reviewed-on: https://chromium-review.googlesource.com/c/1461172
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59581}
2019-02-13 23:22:43 +00:00

151 lines
3.8 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.
let listFormat = new Intl.ListFormat();
// The default style is 'long'
assertEquals('long', listFormat.resolvedOptions().style);
// The default type is 'conjunction'
assertEquals('conjunction', listFormat.resolvedOptions().type);
assertEquals(
'short',
(new Intl.ListFormat(['sr'], {style: 'short'}))
.resolvedOptions().style);
assertEquals(
'conjunction',
(new Intl.ListFormat(['sr'], {style: 'short'}))
.resolvedOptions().type);
assertEquals(
'long',
(new Intl.ListFormat(['sr'], {style: 'long'}))
.resolvedOptions().style);
assertEquals(
'conjunction',
(new Intl.ListFormat(['sr'], {style: 'long'}))
.resolvedOptions().type);
assertEquals(
'conjunction',
(new Intl.ListFormat(['sr'], {type: 'conjunction'}))
.resolvedOptions().type);
assertEquals(
'long',
(new Intl.ListFormat(['sr'], {type: 'conjunction'}))
.resolvedOptions().style);
assertEquals(
'disjunction',
(new Intl.ListFormat(['sr'], {type: 'disjunction'}))
.resolvedOptions().type);
assertEquals(
'long',
(new Intl.ListFormat(['sr'], {type: 'disjunction'}))
.resolvedOptions().style);
assertEquals(
'unit',
(new Intl.ListFormat(['sr'], {type: 'unit'}))
.resolvedOptions().type);
assertEquals(
'long',
(new Intl.ListFormat(['sr'], {type: 'unit'}))
.resolvedOptions().style);
assertEquals(
'conjunction',
(new Intl.ListFormat(['sr'], {style: 'long', type: 'conjunction'}))
.resolvedOptions().type);
assertEquals(
'long',
(new Intl.ListFormat(['sr'], {style: 'long', type: 'conjunction'}))
.resolvedOptions().style);
assertEquals(
'conjunction',
(new Intl.ListFormat(['sr'], {style: 'short', type: 'conjunction'}))
.resolvedOptions().type);
assertEquals(
'short',
(new Intl.ListFormat(['sr'], {style: 'short', type: 'conjunction'}))
.resolvedOptions().style);
assertEquals(
'disjunction',
(new Intl.ListFormat(['sr'], {style: 'long', type: 'disjunction'}))
.resolvedOptions().type);
assertEquals(
'long',
(new Intl.ListFormat(['sr'], {style: 'long', type: 'disjunction'}))
.resolvedOptions().style);
assertEquals(
'disjunction',
(new Intl.ListFormat(['sr'], {style: 'short', type: 'disjunction'}))
.resolvedOptions().type);
assertEquals(
'short',
(new Intl.ListFormat(['sr'], {style: 'short', type: 'disjunction'}))
.resolvedOptions().style);
assertEquals(
'unit',
(new Intl.ListFormat(['sr'], {style: 'long', type: 'unit'}))
.resolvedOptions().type);
assertEquals(
'long',
(new Intl.ListFormat(['sr'], {style: 'long', type: 'unit'}))
.resolvedOptions().style);
assertEquals(
'unit',
(new Intl.ListFormat(['sr'], {style: 'short', type: 'unit'}))
.resolvedOptions().type);
assertEquals(
'short',
(new Intl.ListFormat(['sr'], {style: 'short', type: 'unit'}))
.resolvedOptions().style);
assertEquals(
'unit',
(new Intl.ListFormat(['sr'], {style: 'narrow', type: 'unit'}))
.resolvedOptions().type);
assertEquals(
'narrow',
(new Intl.ListFormat(['sr'], {style: 'narrow', type: 'unit'}))
.resolvedOptions().style);
assertEquals(
'ar',
(new Intl.ListFormat(['ar'])).resolvedOptions().locale);
assertEquals(
'ar',
(new Intl.ListFormat(['ar', 'en'])).resolvedOptions().locale);
assertEquals(
'fr',
(new Intl.ListFormat(['fr', 'en'])).resolvedOptions().locale);
assertEquals(
'ar',
(new Intl.ListFormat(['xyz', 'ar'])).resolvedOptions().locale);
assertEquals(
'ar',
(new Intl.ListFormat(['i-default', 'ar'])).resolvedOptions().locale);