summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/async-function/evaluation-body-that-throws-after-await.js
blob: c2a0e758bf3b2212ce6e1f38885ea8c5b68d0bbe (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
// |reftest| async
// Copyright 2016 Microsoft, Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
author: Brian Terlson <brian.terlson@microsoft.com>
esid: pending
description: >
  Errors thrown from the async function body reject the returned promise
flags: [async]
---*/

async function foo() {
  await Promise.resolve();
  throw 1;
}

foo().then(function () {
  $DONE("Should not be called");
}, function (e) {
  assert.sameValue(e, 1);
  $DONE();
});