blob: 284f369405846bf55f7634db980bd8345f31a06a [file] [log] [blame]
load(libdir + 'asserts.js');
assertEq(Array.prototype.toSource.call([1, 'hi']), '[1, "hi"]');
assertEq(Array.prototype.toSource.call({1: 10, 0: 42, length: 2}), "[42, 10]");
assertEq(Array.prototype.toSource.call({1: 10, 0: 42, length: 1}), "[42]");
assertThrowsInstanceOf(() => Array.prototype.toSource.call("someString"), TypeError);
assertThrowsInstanceOf(() => Array.prototype.toSource.call(42), TypeError);
assertThrowsInstanceOf(() => Array.prototype.toSource.call(undefined), TypeError);