summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/resolve/arg-non-thenable.js
blob: 1f941e050bd5068e7babb1b9604fbcf611e32f31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// |reftest| async
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: >
    `Promise.resolve` invoked with an object whose `then` property is not callable
es6id: 25.4.4.5
info: |
    6. Let resolveResult be Call(promiseCapability.[[Resolve]], undefined,
       «x»).

    [...]

    25.4.1.3.2 Promise Resolve Functions

    11. If IsCallable(thenAction) is false, then
        a. Return FulfillPromise(promise, resolution).
    12. Perform EnqueueJob ("PromiseJobs", PromiseResolveThenableJob,
        «promise, resolution, thenAction»)
    13. Return undefined.
flags: [async]
---*/

var nonThenable = {
  then: null
};

Promise.resolve(nonThenable).then(function(value) {
  assert.sameValue(value, nonThenable);
}).then($DONE, $DONE);