Debian Codegraph @

js/src/tests/test262/built-ins/Promise/undefined-newtarget.js

raw
1 // Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-promise-executor
5 description: >
6 Throws a TypeError if Promise is called without a NewTarget.
7 info: |
8 25.6.3.1 Promise ( executor )
9
10 1. If NewTarget is undefined, throw a TypeError exception.
11 ---*/
12
13 assert.throws(TypeError, function() {
14 Promise(function() {});
15 });
16
17 assert.throws(TypeError, function() {
18 Promise.call(null, function() {});
19 });
20
21 var p = new Promise(function() {});
22 assert.throws(TypeError, function() {
23 Promise.call(p, function() {});
24 });
25
26 reportCompare(0, 0);