Debian Codegraph @

js/src/tests/test262/intl402/Locale/constructor-options-throwing-getters.js

raw
1 // Copyright 2018 Igalia, S.L. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-Intl.Locale
6 description: Checks the propagation of exceptions from the options for the Locale constructor.
7 features: [Intl.Locale]
8 ---*/
9
10 function CustomError() {}
11
12 const options = [
13 "language",
14 "script",
15 "region",
16 "calendar",
17 "collation",
18 "hourCycle",
19 "caseFirst",
20 "numeric",
21 "numberingSystem",
22 ];
23
24 for (const option of options) {
25 assert.throws(CustomError, () => {
26 new Intl.Locale("en", {
27 get [option]() {
28 throw new CustomError();
29 }
30 });
31 },
32 `new Intl.Locale("en", {get ${option}() {throw new CustomError();}}) throws CustomError`);
33 }
34
35 reportCompare(0, 0);