Debian Codegraph @

js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables-that-throw.js

raw
1 // |reftest| module async
2 // Copyright 2019 Leo Balter. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: prod-AwaitExpression
7 description: >
8 Await can await any thenable.
9 flags: [module, async]
10 features: [top-level-await]
11 ---*/
12
13 var error = {};
14 var thenable = {
15 then: function (resolve, reject) {
16 throw error;
17 }
18 }
19
20 var caught = false;
21 try {
22 await thenable;
23 } catch(e) {
24 caught = e;
25
26 }
27
28 assert.sameValue(caught, error);
29
30 $DONE();