blob: 284f369405846bf55f7634db980bd8345f31a06a (
plain)
1
2
3
4
5
6
7
8
|
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);
|