Debian Codegraph @

js/src/tests/test262/intl402/Collator/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-initializecollator
6 description: Checks the propagation of exceptions from the options for the Collator constructor.
7 ---*/
8
9 function CustomError() {}
10
11 const options = [
12 "usage",
13 "localeMatcher",
14 "collation",
15 "numeric",
16 "caseFirst",
17 "sensitivity",
18 "ignorePunctuation",
19 ];
20
21 for (const option of options) {
22 assert.throws(CustomError, () => {
23 new Intl.Collator("en", {
24 get [option]() {
25 throw new CustomError();
26 }
27 });
28 }, `Exception from ${option} getter should be propagated`);
29 }
30
31 reportCompare(0, 0);