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