summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/withResolvers/ctx-non-object.js
blob: 3be318a003851c57ccf0a13d2fbaea661624ee94 (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) 2023 Peter Klecha. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: Promise.withResolvers errors when the receiver is not an object
esid: sec-promise.withresolvers
features: [promise-with-resolvers]
---*/

assert.throws(TypeError, function() {
  Promise.withResolvers.call(undefined);
});

assert.throws(TypeError, function() {
  Promise.withResolvers.call(null);
});

assert.throws(TypeError, function() {
  Promise.withResolvers.call(86);
});
  
assert.throws(TypeError, function() {
  Promise.withResolvers.call('string');
});

assert.throws(TypeError, function() {
  Promise.withResolvers.call(true);
});

assert.throws(TypeError, function() {
  Promise.withResolvers.call(Symbol());
});

reportCompare(0, 0);