constructor-options-throwing-getters-timedate-style.js (820B)
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 features: [Intl.DateTimeFormat-datetimestyle] 8 ---*/ 9 10 // To be merged into constructor-options-throwing-getters.js when the feature is removed. 11 12 function CustomError() {} 13 14 const options = [ 15 // CreateDateTimeFormat step 39 16 "dateStyle", 17 // CreateDateTimeFormat step 41 18 "timeStyle", 19 ]; 20 21 for (const option of options) { 22 assert.throws(CustomError, () => { 23 new Intl.DateTimeFormat("en", { 24 get [option]() { 25 throw new CustomError(); 26 } 27 }); 28 }, `Exception from ${option} getter should be propagated`); 29 } 30 31 reportCompare(0, 0);