Debian Codegraph @

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

raw
1 // |reftest| shell-option(--enable-promise-try) skip-if(!Promise.try||!xulRuntime.shell) -- promise-try is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2024 Jordan Harband. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 description: Promise.try errors when the receiver is not an object
7 esid: sec-promise.try
8 features: [promise-try]
9 ---*/
10
11 assert.throws(TypeError, function () {
12 Promise.try.call(undefined);
13 });
14
15 assert.throws(TypeError, function () {
16 Promise.try.call(null);
17 });
18
19 assert.throws(TypeError, function () {
20 Promise.try.call(86);
21 });
22
23 assert.throws(TypeError, function () {
24 Promise.try.call('string');
25 });
26
27 assert.throws(TypeError, function () {
28 Promise.try.call(true);
29 });
30
31 assert.throws(TypeError, function () {
32 Promise.try.call(Symbol());
33 });
34
35 reportCompare(0, 0);