summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/undefined-newtarget.js
blob: e672e2a63e8f38b3c3f5f378e50aed750af08c4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-promise-executor
description: >
  Throws a TypeError if Promise is called without a NewTarget.
info: |
  25.6.3.1 Promise ( executor )

  1. If NewTarget is undefined, throw a TypeError exception.
---*/

assert.throws(TypeError, function() {
  Promise(function() {});
});

assert.throws(TypeError, function() {
  Promise.call(null, function() {});
});

var p = new Promise(function() {});
assert.throws(TypeError, function() {
  Promise.call(p, function() {});
});

reportCompare(0, 0);