michael@0: load(libdir + "asserts.js"); michael@0: michael@0: function f(arr, v1, v2) michael@0: { michael@0: // Ensure array_push_slowly is called by passing more than one argument. michael@0: arr.push(v1, v2); michael@0: } michael@0: michael@0: function basic() michael@0: { michael@0: // Use a much-greater capacity than the eventual non-writable length. michael@0: var a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; michael@0: Object.defineProperty(a, "length", { writable: false, value: 6 }); michael@0: michael@0: assertThrowsInstanceOf(() => f(a, 8675309, 3141592), TypeError); michael@0: michael@0: assertEq(a.hasOwnProperty(6), false); michael@0: assertEq(a[6], undefined); michael@0: assertEq(a.hasOwnProperty(7), false); michael@0: assertEq(a[7], undefined); michael@0: assertEq(a.length, 6); michael@0: } michael@0: michael@0: basic();