options-invalid.js (720B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2022 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-temporal.plainyearmonth.from 7 description: TypeError thrown when a primitive is passed as the options argument 8 features: [Temporal] 9 ---*/ 10 11 const items = [ 12 { year: 2000, month: 11 }, 13 "2000-11", 14 new Temporal.PlainYearMonth(2000, 11), 15 ]; 16 const values = [null, true, "hello", Symbol("foo"), 1, 1n]; 17 18 for (const item of items) { 19 for (const badOptions of values) { 20 assert.throws(TypeError, () => Temporal.PlainYearMonth.from(item, badOptions)); 21 } 22 } 23 24 reportCompare(0, 0);