Debian Codegraph @

js/src/tests/test262/intl402/NumberFormat/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-initializenumberformat
6 description: Checks the propagation of exceptions from the options for the NumberFormat constructor.
7 ---*/
8
9 function CustomError() {}
10
11 const options = [
12 "localeMatcher",
13 "numberingSystem",
14 "style",
15 "currency",
16 "currencyDisplay",
17 "minimumIntegerDigits",
18 "minimumFractionDigits",
19 "maximumFractionDigits",
20 "minimumSignificantDigits",
21 "maximumSignificantDigits",
22 "useGrouping",
23 ];
24
25 for (const option of options) {
26 assert.throws(CustomError, () => {
27 new Intl.NumberFormat("en", {
28 get [option]() {
29 throw new CustomError();
30 }
31 });
32 }, `Exception from ${option} getter should be propagated`);
33 }
34
35 reportCompare(0, 0);