diff options
Diffstat (limited to '')
-rw-r--r-- | js/src/tests/test262/built-ins/DataView/prototype/setBigInt64/negative-byteoffset-throws.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/DataView/prototype/setBigInt64/negative-byteoffset-throws.js b/js/src/tests/test262/built-ins/DataView/prototype/setBigInt64/negative-byteoffset-throws.js new file mode 100644 index 0000000000..f404def868 --- /dev/null +++ b/js/src/tests/test262/built-ins/DataView/prototype/setBigInt64/negative-byteoffset-throws.js @@ -0,0 +1,24 @@ +// Copyright (C) 2017 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-dataview.prototype.setbigint64 +description: > + Throws a RangeError if getIndex < 0 +features: [DataView, ArrayBuffer, BigInt] +---*/ + +var buffer = new ArrayBuffer(12); +var sample = new DataView(buffer, 0); + +assert.throws(RangeError, function() { + sample.setBigInt64(-1, 39n); +}, "DataView access at index -1 should throw"); +assert.sameValue(sample.getBigInt64(0), 0n, "-1 - no value was set"); + +assert.throws(RangeError, function() { + sample.setBigInt64(-Infinity, 39n); +}, "DataView access at index -Infinity should throw"); +assert.sameValue(sample.getBigInt64(0), 0n, "-Infinity - no value was set"); + +reportCompare(0, 0); |