v8/test/intl/list-format/constructor.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

89 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.
// ListFormat constructor can't be called as function.
assertThrows(() => Intl.ListFormat(['sr']), TypeError);
// Non-string locale.
// assertThrows(() => new Intl.ListFormat(5), TypeError);
// Invalid locale string.
assertThrows(() => new Intl.ListFormat(['abcdefghi']), RangeError);
assertDoesNotThrow(() => new Intl.ListFormat(['sr'], {}), TypeError);
assertDoesNotThrow(() => new Intl.ListFormat([], {}));
assertDoesNotThrow(() => new Intl.ListFormat(['fr', 'ar'], {}));
assertDoesNotThrow(() => new Intl.ListFormat({0: 'ja', 1:'fr'}, {}));
assertDoesNotThrow(() => new Intl.ListFormat({1: 'ja', 2:'fr'}, {}));
assertDoesNotThrow(() => new Intl.ListFormat(['sr']));
assertDoesNotThrow(() => new Intl.ListFormat());
assertDoesNotThrow(
() => new Intl.ListFormat(
['sr'], {
style: 'short',
type: 'unit'
}));
assertDoesNotThrow(
() => new Intl.ListFormat(['sr'], {type: 'conjunction'}));
assertDoesNotThrow(
() => new Intl.ListFormat(['sr'], {type: 'disjunction'}));
assertDoesNotThrow(
() => new Intl.ListFormat(['sr'], {type: 'unit'}));
assertThrows(
() => new Intl.ListFormat(['sr'], {type: 'standard'}),
RangeError);
assertDoesNotThrow(
() => new Intl.ListFormat(['sr'], {style: 'long'}));
assertDoesNotThrow(
() => new Intl.ListFormat(['sr'], {style: 'short'}));
assertThrows(() => new Intl.ListFormat(['sr'], {style: 'narrow'}), RangeError);
assertThrows(
() => new Intl.ListFormat(['sr'], {style: 'giant'}),
RangeError);
assertDoesNotThrow(
() => new Intl.ListFormat(['sr'], {type: 'conjunction', style: 'long'}));
assertDoesNotThrow(
() => new Intl.ListFormat(['sr'], {type: 'conjunction', style: 'short'}));
assertThrows(
() => new Intl.ListFormat(['sr'], {type: 'conjunction', style: 'narrow'}),
RangeError);
assertDoesNotThrow(
() => new Intl.ListFormat(['sr'], {type: 'disjunction', style: 'long'}));
assertDoesNotThrow(
() => new Intl.ListFormat(['sr'], {type: 'disjunction', style: 'short'}));
assertThrows(
() => new Intl.ListFormat(['sr'], {type: 'disjunction', style: 'narrow'}),
RangeError);
assertDoesNotThrow(
() => new Intl.ListFormat(['sr'], {type: 'unit', style: 'long'}));
assertDoesNotThrow(
() => new Intl.ListFormat(['sr'], {type: 'unit', style: 'short'}));
assertDoesNotThrow(
() => new Intl.ListFormat(['sr'], {type: 'unit', style: 'narrow'}));