[javascriptcore-test262-automation] Changes from https://github.com/webkit/webkit.git at sha b85a66fba6 on Tue Nov 13 2018 18:55:51 GMT+0000 (Coordinated Universal Time)

This commit is contained in:
test262-automation 2018-11-13 18:58:38 +00:00
parent 6a33901762
commit 33df80e9ad
1 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,63 @@
//@ runDefault("--useBigInt=true", "--useDFGJIT=false")
function assert(a, message) {
if (!a)
throw new Error(message);
}
function lshift(y) {
let out = 1n;
for (let i = 0; i < y; i++) {
out *= 2n;
}
return out;
}
let a = lshift(16384 * 63);
for (let i = 0; i < 256; i++) {
a *= 18446744073709551615n;
}
try {
let b = a + 1n;
assert(false, "Should throw OutOfMemoryError, but executed without exception");
} catch(e) {
assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
}
try {
let b = a - (-1n);
assert(false, "Should throw OutOfMemoryError, but executed without exception");
} catch(e) {
assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
}
try {
let b = a * (-1n);
assert(false, "Should throw OutOfMemoryError, but executed without exception");
} catch(e) {
assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
}
try {
let b = a / a;
assert(false, "Should throw OutOfMemoryError, but executed without exception");
} catch(e) {
assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
}
try {
let b = -a & -1n;
assert(false, "Should throw OutOfMemoryError, but executed without exception");
} catch(e) {
assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
}
try {
let b = a ^ -1n;
assert(false, "Should throw OutOfMemoryError, but executed without exception");
} catch(e) {
assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
}