summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/prototype/toString/proxy-function-async.js
blob: 094b7c0e70bed27e7aeb90328e893fe90fc3c0be (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
33
34
// Copyright (C) 2019 Alexey Shvayka. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-object.prototype.tostring
description: Proxy of async function is treated as a function.
info: |
  ProxyCreate ( target, handler )

  [...]
  7. If IsCallable(target) is true, then
    a. Set P.[[Call]] as specified in 9.5.12.

  Object.prototype.toString ( )

  [...]
  7. Else if O has a [[Call]] internal method, let builtinTag be "Function".
features: [async-functions, Proxy, Symbol.toStringTag]
---*/

var asyncProxy = new Proxy(async function() {}, {});
var asyncProxyProxy = new Proxy(asyncProxy, {});

assert.sameValue(
  Object.prototype.toString.call(asyncProxy),
  '[object AsyncFunction]',
  'async function proxy'
);
assert.sameValue(
  Object.prototype.toString.call(asyncProxyProxy),
  '[object AsyncFunction]',
  'proxy for async function proxy'
);

reportCompare(0, 0);