blob: c1487eed26df6a6f0a07ab2e3640b9c0f36bf478 [file] [log] [blame]
//@ runBigIntEnabled
function assert(a, message) {
if (!a)
throw new Error(message);
}
function assertThrowRangeError(a, b, message) {
try {
let n = a << b;
assert(false, message + ": Should throw RangeError, but executed without exception");
} catch (e) {
assert(e instanceof Error, message + ": expected Error , got: " + e);
}
}
let a = 1n << 64n;
assertThrowRangeError(1n, a, "Left shift by " + a);
a = 1n << 30n;
assertThrowRangeError(1n, a, "Left shift by " + a);