Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/all/resolve-element-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.4.1.2
6 description: Promise.all Resolve Element 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 resolveElementFunction;
15 var thenable = {
16 then: function(fulfill) {
17 resolveElementFunction = fulfill;
18 }
19 };
20
21 function NotPromise(executor) {
22 executor(function() {}, function() {});
23 }
24 NotPromise.resolve = function(v) {
25 return v;
26 };
27 Promise.all.call(NotPromise, [thenable]);
28
29 assert.sameValue(Object.prototype.hasOwnProperty.call(resolveElementFunction, "prototype"), false);
30 assert.throws(TypeError, function() {
31 new resolveElementFunction();
32 });