Backed out 3 changesets (bug 1892041) for causing failures on async-module-does-not...
[gecko.git] / js / src / tests / test262 / built-ins / TypedArray / prototype / byteOffset / return-byteoffset.js
blob889aef45b5c675331c2c431261fadfae202c95fe
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-get-%typedarray%.prototype.byteoffset
5 description: >
6   Return value from [[ByteOffset]] internal slot
7 info: |
8   22.2.3.3 get %TypedArray%.prototype.byteOffset
10   ...
11   6. Let offset be the value of O's [[ByteOffset]] internal slot.
12   7. Return size.
13 includes: [testTypedArray.js]
14 features: [TypedArray]
15 ---*/
17 testWithTypedArrayConstructors(function(TA) {
18   var ta1 = new TA();
19   assert.sameValue(ta1.byteOffset, 0, "Regular typedArray");
21   var offset = 4 * TA.BYTES_PER_ELEMENT;
23   var buffer1 = new ArrayBuffer(8 * TA.BYTES_PER_ELEMENT);
24   var ta2 = new TA(buffer1, offset);
25   assert.sameValue(ta2.byteOffset, offset, "TA(buffer, offset)");
27   var buffer2 = new ArrayBuffer(8 * TA.BYTES_PER_ELEMENT);
28   var sample = new TA(buffer2, offset);
29   var ta3 = new TA(sample);
30   assert.sameValue(ta3.byteOffset, 0, "TA(typedArray)");
31 });
33 reportCompare(0, 0);