summaryrefslogtreecommitdiff
path: root/test/built-ins/TypedArrays/internals/Get/BigInt/indexed-value-sab.js
blob: e8e27c666ccd89be4362e4642d4d3465bcc1f310 (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
25
26
27
28
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-integer-indexed-exotic-objects-get-p-receiver
description: >
  Return value from valid numeric index, with SharedArrayBuffer
includes: [testBigIntTypedArray.js]
features: [BigInt, TypedArray, SharedArrayBuffer]
---*/

var proto = TypedArray.prototype;
var throwDesc = {
  get: function() {
    throw new Test262Error("OrdinaryGet was called! Ref: 9.1.8.1 3.c");
  }
};
Object.defineProperty(proto, "0", throwDesc);
Object.defineProperty(proto, "1", throwDesc);

testWithBigIntTypedArrayConstructors(function(TA) {
  var sab = new SharedArrayBuffer(TA.BYTES_PER_ELEMENT * 2);
  var sample = new TA(sab);
  sample.set([42n, 1n]);

  assert.sameValue(sample["0"], 42n);
  assert.sameValue(sample["1"], 1n);
});