improve error messages

This commit is contained in:
Robin Templeton 2017-10-24 11:48:34 -04:00
parent cca3876881
commit 2892cc78c7
5 changed files with 12 additions and 7 deletions

View File

@ -29,6 +29,8 @@ var sample = new DataView(buffer, 0);
$DETACHBUFFER(buffer);
assert.throws(RangeError, () => sample.getBigInt64(Infinity), "Infinity");
assert.throws(RangeError, () => sample.getBigInt64(Infinity),
"DataView access at index Infinity should throw");
assert.throws(RangeError, () => sample.getBigInt64(-1), "-1");
assert.throws(RangeError, () => sample.getBigInt64(-1),
"DataView access at index -1 should throw");

View File

@ -31,4 +31,5 @@ sample = new DataView(buffer, 0);
$DETACHBUFFER(buffer);
assert.throws(TypeError, () => sample.getBigInt64(13), "13");
assert.throws(TypeError, () => sample.getBigInt64(13),
"detached DataView access should throw");

View File

@ -26,4 +26,5 @@ var buffer = new ArrayBuffer(1);
var sample = new DataView(buffer, 0);
$DETACHBUFFER(buffer);
assert.throws(TypeError, () => sample.getBigInt64(0), "0");
assert.throws(TypeError, () => sample.getBigInt64(0),
"detached DataView access should throw");

View File

@ -30,7 +30,7 @@ var buffer = new ArrayBuffer(12);
sample = new DataView(buffer, 0);
assert.throws(RangeError, () => sample.getBigInt64(Infinity),
"Infinity");
"DataView access at index Infinity should throw");
assert.throws(RangeError, () => sample.getBigInt64(13), "13 + 8 > 12");

View File

@ -23,7 +23,8 @@ features: [DataView, ArrayBuffer, BigInt, arrow-function]
var buffer = new ArrayBuffer(12);
var sample = new DataView(buffer, 0);
assert.throws(RangeError, () => sample.getBigInt64(-1), "-1");
assert.throws(RangeError, () => sample.getBigInt64(-1),
"DataView access at index -1 should throw");
assert.throws(RangeError, () => sample.getBigInt64(-Infinity),
"-Infinity");
"DataView access at index -Infinity should throw");