summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/DataView/prototype/setBigInt64/negative-byteoffset-throws.js
blob: f404def8685a529f0e8b4f2722ef293d7bf49903 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);