3f270f34a1
Intl.DisplayNames was shipped in m81 and we now can remove the flag. https://www.chromestatus.com/features/4965112605573120 Bug: v8:8703 Change-Id: Ib65d787c1871aa1da38a22fdb9e369c680c7d2c9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2163820 Commit-Queue: Frank Tang <ftang@chromium.org> Reviewed-by: Shu-yu Guo <syg@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#67382}
89 lines
2.3 KiB
JavaScript
89 lines
2.3 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.
|
|
|
|
// 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'}));
|
|
|
|
assertThrows(
|
|
() => new Intl.DisplayNames('sr', {type: ''}),
|
|
RangeError);
|