tests/auto/qml/ecmascripttests/test262/test/language/expressions/await/await-awaits-thenables.js
raw| 1 | // Copyright 2016 Microsoft, Inc. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | |
| 4 | /*--- |
| 5 | author: Brian Terlson <[email protected]> |
| 6 | esid: pending |
| 7 | description: > |
| 8 | Await can await any thenable. |
| 9 | flags: [async] |
| 10 | ---*/ |
| 11 | |
| 12 | var thenable = { |
| 13 | then: function (resolve, reject) { |
| 14 | resolve(42); |
| 15 | } |
| 16 | } |
| 17 | async function foo() { |
| 18 | assert.sameValue(await thenable, 42); |
| 19 | } |
| 20 | |
| 21 | foo().then($DONE, $DONE); |