blob: 6bc8b2c9f3be08a11ec9faee7793a67315c0ee5a [file] [log] [blame] [edit]
function shouldBe(a, b) {
if (a !== b)
throw new Error(`Expected ${b} but got ${a}`);
}
function NonArray() {}
for (let i = 0; i < testLoopCount; i ++) {
const nonArray = Array.of.call(NonArray, i, i + 1, i + 2, i + 3);
shouldBe(nonArray instanceof Array, false);
shouldBe(nonArray instanceof NonArray, true);
shouldBe(nonArray.length, 4);
shouldBe(nonArray[0], i);
shouldBe(nonArray[1], i + 1);
shouldBe(nonArray[2], i + 2);
shouldBe(nonArray[3], i + 3);
}