Debian Codegraph @

js/src/tests/test262/built-ins/Promise/resolve/arg-non-thenable.js

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