undefined-newtarget-throws.js (629B)
1 // Copyright (C) 2019 Leo Balter. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-weak-ref-target 6 description: > 7 Throws a TypeError if NewTarget is undefined. 8 info: | 9 WeakRef ( target ) 10 11 1. If NewTarget is undefined, throw a TypeError exception. 12 2. If Type(target) is not Object, throw a TypeError exception. 13 ... 14 features: [WeakRef] 15 ---*/ 16 17 assert.sameValue( 18 typeof WeakRef, 'function', 19 'typeof WeakRef is function' 20 ); 21 22 assert.throws(TypeError, function() { 23 WeakRef(); 24 }); 25 26 assert.throws(TypeError, function() { 27 WeakRef({}); 28 }); 29 30 reportCompare(0, 0);