await-awaits-thenable-not-callable.js (526B)
1 // |reftest| async 2 // Copyright 2016 Microsoft, Inc. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 author: Brian Terlson <brian.terlson@microsoft.com> 7 esid: pending 8 description: > 9 Await can await any thenable. If the thenable's then is not callable, 10 await evaluates to the thenable 11 flags: [async] 12 includes: [asyncHelpers.js] 13 ---*/ 14 15 async function foo() { 16 var thenable = { then: 42 }; 17 var res = await thenable; 18 assert.sameValue(res, thenable); 19 } 20 21 asyncTest(foo);