Debian Codegraph @

js/src/tests/test262/intl402/PluralRules/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-initializepluralrules
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 "type",
14 "notation",
15 "minimumIntegerDigits",
16 "minimumFractionDigits",
17 "maximumFractionDigits",
18 "minimumSignificantDigits",
19 "maximumSignificantDigits",
20 ];
21
22 for (const option of options) {
23 assert.throws(CustomError, () => {
24 new Intl.PluralRules("en", {
25 get [option]() {
26 throw new CustomError();
27 }
28 });
29 }, `Exception from ${option} getter should be propagated`);
30 }
31
32 reportCompare(0, 0);