blob: 2527d00db85cd232eb0647c4e06943284d8f9ca1 [file] [edit]
"use strict";
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error("got " + actual + ", expected " + expected);
}
function shouldThrow(func, errorType) {
let threw = null;
try { func(); } catch (e) { threw = e; }
if (!threw || threw.constructor !== errorType)
throw new Error("expected " + errorType.name + ", got " + threw);
}
function f(a, n) { a.length = n; }
noInline(f);
for (let i = 0; i < testLoopCount; ++i) {
let a = [1, 2, 3];
shouldThrow(() => f(a, 1.5), RangeError);
shouldBe(a.length, 3);
}