newtarget-undefined.js (707B)
1 // Copyright 2022 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-Intl.DurationFormat 6 description: > 7 Verifies the NewTarget check for Intl.DurationFormat. 8 info: | 9 Intl.DurationFormat ([ locales [ , options ]]) 10 (...) 11 1. If NewTarget is undefined, throw a TypeError exception. 12 features: [Intl.DurationFormat] 13 ---*/ 14 15 assert.sameValue(typeof Intl.DurationFormat, "function"); 16 17 assert.throws(TypeError, function() { 18 Intl.DurationFormat(); 19 }); 20 21 assert.throws(TypeError, function() { 22 Intl.DurationFormat("en"); 23 }); 24 25 assert.throws(TypeError, function() { 26 Intl.DurationFormat("not-valid-tag"); 27 }); 28 29 reportCompare(0, 0);