Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/executor-function-nonconstructor.js

raw
1 // Copyright (C) 2015 André Bargull. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 es6id: 25.4.1.5.1
6 description: GetCapabilitiesExecutor functions are not constructors
7 info: |
8 17 ECMAScript Standard Built-in Objects:
9 Built-in function objects that are not identified as constructors do not
10 implement the [[Construct]] internal method unless otherwise specified
11 in the description of a particular function.
12 ---*/
13
14 var executorFunction;
15
16 function NotPromise(executor) {
17 executorFunction = executor;
18 executor(function() {}, function() {});
19 }
20 Promise.resolve.call(NotPromise);
21
22 assert.sameValue(Object.prototype.hasOwnProperty.call(executorFunction, "prototype"), false);
23 assert.throws(TypeError, function() {
24 new executorFunction();
25 });