162c5b0ff9
Design Doc https://shorturl.at/emEHW I2I: http://shorturl.at/pKRUV Bug: v8:8703 Change-Id: I9573b2ee6f1dce4dc594aa1df2753095f45af15e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1848683 Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/master@{#65021}
105 lines
2.8 KiB
JavaScript
105 lines
2.8 KiB
JavaScript
// Copyright 2019 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.
|
|
|
|
// Flags: --harmony-intl-displaynames
|
|
// DisplayNames constructor can't be called as function.
|
|
assertThrows(() => Intl.DisplayNames('sr'), TypeError);
|
|
|
|
assertDoesNotThrow(() => new Intl.DisplayNames('sr', {}));
|
|
|
|
assertDoesNotThrow(() => new Intl.DisplayNames([], {}));
|
|
|
|
assertDoesNotThrow(() => new Intl.DisplayNames(['fr', 'ar'], {}));
|
|
|
|
assertDoesNotThrow(() => new Intl.DisplayNames({0: 'ja', 1:'fr'}, {}));
|
|
|
|
assertDoesNotThrow(() => new Intl.DisplayNames({1: 'ja', 2:'fr'}, {}));
|
|
|
|
assertDoesNotThrow(() => new Intl.DisplayNames('sr'));
|
|
|
|
assertDoesNotThrow(() => new Intl.DisplayNames());
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames(
|
|
'sr', {
|
|
localeMatcher: 'lookup',
|
|
style: 'short',
|
|
type: 'language',
|
|
fallback: 'code',
|
|
}));
|
|
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {localeMatcher: 'lookup'}));
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {localeMatcher: 'best fit'}));
|
|
|
|
assertThrows(
|
|
() => new Intl.DisplayNames('sr', {localeMatcher: 'hello'}),
|
|
RangeError);
|
|
|
|
assertThrows(
|
|
() => new Intl.DisplayNames('sr', {localeMatcher: 'look up'}),
|
|
RangeError);
|
|
|
|
assertThrows(
|
|
() => new Intl.DisplayNames('sr', {localeMatcher: 'bestfit'}),
|
|
RangeError);
|
|
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {style: 'long'}));
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {style: 'short'}));
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {style: 'narrow'}));
|
|
|
|
assertThrows(
|
|
() => new Intl.DisplayNames('sr', {style: 'giant'}),
|
|
RangeError);
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {fallback: 'code'}));
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {fallback: 'none'}));
|
|
|
|
assertThrows(
|
|
() => new Intl.DisplayNames('sr', {fallback: 'never'}),
|
|
RangeError);
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {type: 'language'}));
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {type: 'region'}));
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {type: 'script'}));
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {type: 'currency'}));
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {type: 'month'}));
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {type: 'weekday'}));
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {type: 'quarter'}));
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {type: 'dayPeriod'}));
|
|
|
|
assertDoesNotThrow(
|
|
() => new Intl.DisplayNames('sr', {type: 'dateTimeField'}));
|
|
|
|
assertThrows(
|
|
() => new Intl.DisplayNames('sr', {type: ''}),
|
|
RangeError);
|