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