Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/resolve/arg-non-thenable.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: >
6 `Promise.resolve` invoked with an object whose `then` property is not callable
7 es6id: 25.4.4.5
8 info: |
9 6. Let resolveResult be Call(promiseCapability.[[Resolve]], undefined,
10 «x»).
11
12 [...]
13
14 25.4.1.3.2 Promise Resolve Functions
15
16 11. If IsCallable(thenAction) is false, then
17 a. Return FulfillPromise(promise, resolution).
18 12. Perform EnqueueJob ("PromiseJobs", PromiseResolveThenableJob,
19 «promise, resolution, thenAction»)
20 13. Return undefined.
21 flags: [async]
22 ---*/
23
24 var nonThenable = {
25 then: null
26 };
27
28 Promise.resolve(nonThenable).then(function(value) {
29 assert.sameValue(value, nonThenable);
30 }).then($DONE, $DONE);