Debian Codegraph @

js/src/tests/test262/built-ins/WeakRef/undefined-newtarget-throws.js

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