Debian Codegraph @

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

raw
1 // Copyright 2019 Google Inc. 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 features: [Intl.DateTimeFormat-dayPeriod]
8 ---*/
9
10 function CustomError() {}
11
12 const options = [
13 "dayPeriod",
14 ];
15
16 for (const option of options) {
17 assert.throws(CustomError, () => {
18 new Intl.DateTimeFormat("en", {
19 get [option]() {
20 throw new CustomError();
21 }
22 });
23 }, `Exception from ${option} getter should be propagated`);
24 }
25
26 reportCompare(0, 0);