summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/executor-not-callable.js
blob: 76478606f4a7dc8d3dc37de3f39b96770b796fdf (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
27
28
29
30
31
// Copyright 2014 Cubane Canada, Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-promise-executor
author: Sam Mikes
description: >
  Promise constructor throws TypeError if executor is not callable.
info: |
  25.6.3.1 Promise ( executor )

  [...]
  2. If IsCallable(executor) is false, throw a TypeError exception.
---*/

assert.throws(TypeError, function() {
  new Promise('not callable');
});

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

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

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

reportCompare(0, 0);