Debian Codegraph @

js/src/tests/test262/intl402/DisplayNames/options-null-throws.js

raw
1 // Copyright (C) 2019 Leo Balter. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-Intl.DisplayNames
6 description: >
7 Throws TypeError if options is null
8 info: |
9 Intl.DisplayNames ([ locales [ , options ]])
10
11 1. If NewTarget is undefined, throw a TypeError exception.
12 2. Let displayNames be ? OrdinaryCreateFromConstructor(NewTarget, "%DisplayNamesPrototype%",
13 « [[InitializedDisplayNames]], [[Locale]], [[Style]], [[Type]], [[Fallback]], [[Fields]] »).
14 ...
15 4. If options is undefined, then
16 a. Let options be ObjectCreate(null).
17 5. Else
18 a. Let options be ? ToObject(options).
19 ...
20 features: [Intl.DisplayNames]
21 locale: [en]
22 ---*/
23
24 assert.throws(TypeError, () => {
25 new Intl.DisplayNames('en', null);
26 }, 'null');
27
28 reportCompare(0, 0);