Debian Codegraph @

js/src/tests/test262/intl402/DateTimeFormat/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-createdatetimeformat
6 description: Checks the propagation of exceptions from the options for the DateTimeFormat constructor.
7 ---*/
8
9 function CustomError() {}
10
11 const options = [
12 "weekday", "year", "month", "day",
13 "hour", "minute", "second",
14 "localeMatcher",
15 "hour12",
16 "hourCycle",
17 "timeZone",
18 "era",
19 "timeZoneName",
20 "formatMatcher",
21 ];
22
23 for (const option of options) {
24 assert.throws(CustomError, () => {
25 new Intl.DateTimeFormat("en", {
26 get [option]() {
27 throw new CustomError();
28 }
29 });
30 }, `Exception from ${option} getter should be propagated`);
31 }
32
33 reportCompare(0, 0);