Debian Codegraph @

js/src/tests/test262/built-ins/Promise/executor-not-callable.js

raw
1 // Copyright 2014 Cubane Canada, Inc. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-promise-executor
5 author: Sam Mikes
6 description: >
7 Promise constructor throws TypeError if executor is not callable.
8 info: |
9 25.6.3.1 Promise ( executor )
10
11 [...]
12 2. If IsCallable(executor) is false, throw a TypeError exception.
13 ---*/
14
15 assert.throws(TypeError, function() {
16 new Promise('not callable');
17 });
18
19 assert.throws(TypeError, function() {
20 new Promise(1);
21 });
22
23 assert.throws(TypeError, function() {
24 new Promise(null);
25 });
26
27 assert.throws(TypeError, function() {
28 new Promise({});
29 });
30
31 reportCompare(0, 0);