aboutsummaryrefslogtreecommitdiffstats
path: root/src/function-forms/error/async-meth.template
blob: 315f7ace49e4daa1d92d5abcafb23dc2111b9835 (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
32
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
path: language/expressions/object/method-definition/async-meth-
name: async method
esid: sec-async-function-definitions
info: |
  14.6 Async Function Definitions

  AsyncMethod :
   async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
flags: [async]
---*/

var callCount = 0;

var obj = {
  async method(/*{ params }*/) {
    /*{ body }*/
    callCount = callCount + 1;
  }
};

obj.method(/*{ args }*/)
  .then(_ => {
    throw new Test262Error('function should not be resolved');
  }, error => assert.sameValue(error.constructor, /*{ error }*/))
  .then(() => {
    assert.sameValue(callCount, 0, 'function body is not evaluated');
  }, $DONE)
  .then($DONE, $DONE);