Debian Codegraph @

js/src/tests/test262/built-ins/Promise/any/ctx-non-object.js

raw
1 // Copyright (C) 2020 Rick Waldron. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: >
6 Promise.any invoked on a non-object value
7 esid: sec-promise.any
8 info: |
9 ...
10 2. Let promiseCapability be ? NewPromiseCapability(C).
11
12 NewPromiseCapability ( C )
13
14 1. If IsConstructor(C) is false, throw a TypeError exception.
15
16 features: [Promise.any, Symbol]
17 ---*/
18
19 assert.throws(TypeError, function() {
20 Promise.any.call(undefined, []);
21 });
22
23 assert.throws(TypeError, function() {
24 Promise.any.call(null, []);
25 });
26
27 assert.throws(TypeError, function() {
28 Promise.any.call(86, []);
29 });
30
31 assert.throws(TypeError, function() {
32 Promise.any.call('string', []);
33 });
34
35 assert.throws(TypeError, function() {
36 Promise.any.call(true, []);
37 });
38
39 assert.throws(TypeError, function() {
40 Promise.any.call(Symbol(), []);
41 });
42
43 reportCompare(0, 0);