Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / Promise / executor-function-not-a-constructor.js
bloba4002a6ee1adcca4d52406380797762fc9cdb5b0
1 // Copyright (C) 2015 AndrĂ© Bargull. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-getcapabilitiesexecutor-functions
6 description: GetCapabilitiesExecutor function is not constructor
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 includes: [isConstructor.js]
13 features: [Reflect.construct, arrow-function]
14 ---*/
16 var executorFunction;
18 function NotPromise(executor) {
19   executorFunction = executor;
20   executor(function() {}, function() {});
22 Promise.resolve.call(NotPromise);
24 assert.sameValue(
25   Object.prototype.hasOwnProperty.call(executorFunction, "prototype"),
26   false,
27   'Object.prototype.hasOwnProperty.call(executorFunction, "prototype") must return false'
29 assert.sameValue(isConstructor(executorFunction), false, 'isConstructor(executorFunction) must return false');
31 assert.throws(TypeError, () => {
32   new executorFunction();
33 });
36 reportCompare(0, 0);