summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/TypedArray/prototype/at
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/TypedArray/prototype/at')
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/BigInt/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/BigInt/return-abrupt-from-this-out-of-bounds.js62
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/BigInt/shell.js42
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/index-argument-tointeger.js37
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/index-non-numeric-argument-tointeger-invalid.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/index-non-numeric-argument-tointeger.js37
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/length.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/name.js32
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/prop-desc.js26
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/return-abrupt-from-this-out-of-bounds.js62
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/return-abrupt-from-this.js42
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-item-relative-index.js39
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-item.js40
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-undefined-for-holes-in-sparse-arrays.js52
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-undefined-for-out-of-range-index.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArray/prototype/at/shell.js0
17 files changed, 561 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/BigInt/browser.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/BigInt/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/BigInt/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/BigInt/return-abrupt-from-this-out-of-bounds.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/BigInt/return-abrupt-from-this-out-of-bounds.js
new file mode 100644
index 0000000000..33f5aeb6d4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/BigInt/return-abrupt-from-this-out-of-bounds.js
@@ -0,0 +1,62 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: Return abrupt when "this" value fails buffer boundary checks
+includes: [testBigIntTypedArray.js]
+features: [ArrayBuffer, BigInt, TypedArray, TypedArray.prototype.at, arrow-function, resizable-arraybuffer]
+---*/
+
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'implements TypedArray.prototype.at'
+);
+
+assert.sameValue(
+ typeof ArrayBuffer.prototype.resize,
+ 'function',
+ 'implements ArrayBuffer.prototype.resize'
+);
+
+testWithBigIntTypedArrayConstructors(TA => {
+ var BPE = TA.BYTES_PER_ELEMENT;
+ var ab = new ArrayBuffer(BPE * 4, {maxByteLength: BPE * 5});
+ var array = new TA(ab, BPE, 2);
+
+ try {
+ ab.resize(BPE * 5);
+ } catch (_) {}
+
+ // no error following grow:
+ array.at(0);
+
+ try {
+ ab.resize(BPE * 3);
+ } catch (_) {}
+
+ // no error following shrink (within bounds):
+ array.at(0);
+
+ var expectedError;
+ try {
+ ab.resize(BPE * 2);
+ // If the preceding "resize" operation is successful, the typed array will
+ // be out out of bounds, so the subsequent prototype method should produce
+ // a TypeError due to the semantics of ValidateTypedArray.
+ expectedError = TypeError;
+ } catch (_) {
+ // The host is permitted to fail any "resize" operation at its own
+ // discretion. If that occurs, the at operation should complete
+ // successfully.
+ expectedError = Test262Error;
+ }
+
+ assert.throws(expectedError, () => {
+ array.at(0);
+ throw new Test262Error('at completed successfully');
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/BigInt/shell.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/BigInt/shell.js
new file mode 100644
index 0000000000..90ee9c114d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/BigInt/shell.js
@@ -0,0 +1,42 @@
+// GENERATED, DO NOT EDIT
+// file: testBigIntTypedArray.js
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ Collection of functions used to assert the correctness of BigInt TypedArray objects.
+defines:
+ - TypedArray
+ - testWithBigIntTypedArrayConstructors
+---*/
+
+/**
+ * The %TypedArray% intrinsic constructor function.
+ */
+var TypedArray = Object.getPrototypeOf(Int8Array);
+
+/**
+ * Calls the provided function for every typed array constructor.
+ *
+ * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor.
+ * @param {Array} selected - An optional Array with filtered typed arrays
+ */
+function testWithBigIntTypedArrayConstructors(f, selected) {
+ /**
+ * Array containing every BigInt typed array constructor.
+ */
+ var constructors = selected || [
+ BigInt64Array,
+ BigUint64Array
+ ];
+
+ for (var i = 0; i < constructors.length; ++i) {
+ var constructor = constructors[i];
+ try {
+ f(constructor);
+ } catch (e) {
+ e.message += " (Testing with " + constructor.name + ".)";
+ throw e;
+ }
+ }
+}
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/browser.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/index-argument-tointeger.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/index-argument-tointeger.js
new file mode 100644
index 0000000000..0177ff8308
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/index-argument-tointeger.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: >
+ Property type and descriptor.
+info: |
+ %TypedArray%.prototype.at( index )
+
+ Let relativeIndex be ? ToInteger(index).
+
+includes: [testTypedArray.js]
+features: [TypedArray, TypedArray.prototype.at]
+---*/
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'The value of `typeof TypedArray.prototype.at` is "function"'
+);
+
+testWithTypedArrayConstructors(TA => {
+ assert.sameValue(typeof TA.prototype.at, 'function', 'The value of `typeof TA.prototype.at` is "function"');
+ let valueOfCallCount = 0;
+ let index = {
+ valueOf() {
+ valueOfCallCount++;
+ return 1;
+ }
+ };
+
+ let a = new TA([0,1,2,3]);
+
+ assert.sameValue(a.at(index), 1, 'a.at({valueOf() {valueOfCallCount++; return 1;}}) must return 1');
+ assert.sameValue(valueOfCallCount, 1, 'The value of `valueOfCallCount` is 1');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/index-non-numeric-argument-tointeger-invalid.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/index-non-numeric-argument-tointeger-invalid.js
new file mode 100644
index 0000000000..e3f65c143d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/index-non-numeric-argument-tointeger-invalid.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: >
+ Property type and descriptor.
+info: |
+ %TypedArray%.prototype.at( index )
+
+ Let relativeIndex be ? ToInteger(index).
+
+includes: [testTypedArray.js]
+features: [TypedArray, TypedArray.prototype.at]
+---*/
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'The value of `typeof TypedArray.prototype.at` is "function"'
+);
+
+testWithTypedArrayConstructors(TA => {
+ assert.sameValue(typeof TA.prototype.at, 'function', 'The value of `typeof TA.prototype.at` is "function"');
+ let a = new TA([0,1,2,3]);
+
+ assert.throws(TypeError, () => {
+ a.at(Symbol());
+ }, '`a.at(Symbol())` throws TypeError');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/index-non-numeric-argument-tointeger.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/index-non-numeric-argument-tointeger.js
new file mode 100644
index 0000000000..4d604500bb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/index-non-numeric-argument-tointeger.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: >
+ Property type and descriptor.
+info: |
+ %TypedArray%.prototype.at( index )
+
+ Let relativeIndex be ? ToInteger(index).
+
+includes: [testTypedArray.js]
+features: [TypedArray, TypedArray.prototype.at]
+---*/
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'The value of `typeof TypedArray.prototype.at` is "function"'
+);
+
+testWithTypedArrayConstructors(TA => {
+ assert.sameValue(typeof TA.prototype.at, 'function', 'The value of `typeof TA.prototype.at` is "function"');
+
+ let a = new TA([0,1,2,3]);
+
+ assert.sameValue(a.at(false), 0, 'a.at(false) must return 0');
+ assert.sameValue(a.at(null), 0, 'a.at(null) must return 0');
+ assert.sameValue(a.at(undefined), 0, 'a.at(undefined) must return 0');
+ assert.sameValue(a.at(""), 0, 'a.at("") must return 0');
+ assert.sameValue(a.at(function() {}), 0, 'a.at(function() {}) must return 0');
+ assert.sameValue(a.at([]), 0, 'a.at([]) must return 0');
+
+ assert.sameValue(a.at(true), 1, 'a.at(true) must return 1');
+ assert.sameValue(a.at("1"), 1, 'a.at("1") must return 1');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/length.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/length.js
new file mode 100644
index 0000000000..acd90fd31c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: >
+ TypedArray.prototype.at.length value and descriptor.
+info: |
+ %TypedArray%.prototype.at( index )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray.prototype.at]
+---*/
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'The value of `typeof TypedArray.prototype.at` is "function"'
+);
+
+assert.sameValue(
+ TypedArray.prototype.at.length, 1,
+ 'The value of TypedArray.prototype.at.length is 1'
+);
+
+verifyNotEnumerable(TypedArray.prototype.at, 'length');
+verifyNotWritable(TypedArray.prototype.at, 'length');
+verifyConfigurable(TypedArray.prototype.at, 'length');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/name.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/name.js
new file mode 100644
index 0000000000..fd4fcf2324
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/name.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: >
+ %TypedArray%.prototype.at.name value and descriptor.
+info: |
+ %TypedArray%.prototype.at( index )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray.prototype.at]
+---*/
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'The value of `typeof TypedArray.prototype.at` is "function"'
+);
+
+assert.sameValue(
+ TypedArray.prototype.at.name, 'at',
+ 'The value of TypedArray.prototype.at.name is "at"'
+);
+
+verifyProperty(TypedArray.prototype.at, 'name', {
+ enumerable: false,
+ writable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/prop-desc.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/prop-desc.js
new file mode 100644
index 0000000000..946b185db0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/prop-desc.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: >
+ Property type and descriptor.
+info: |
+ %TypedArray%.prototype.at( index )
+
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js, testTypedArray.js]
+features: [TypedArray.prototype.at]
+---*/
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'The value of `typeof TypedArray.prototype.at` is "function"'
+);
+
+verifyProperty(TypedArray.prototype, 'at', {
+ enumerable: false,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/return-abrupt-from-this-out-of-bounds.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/return-abrupt-from-this-out-of-bounds.js
new file mode 100644
index 0000000000..57eecff89f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/return-abrupt-from-this-out-of-bounds.js
@@ -0,0 +1,62 @@
+// |reftest| skip -- resizable-arraybuffer is not supported
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: Return abrupt when "this" value fails buffer boundary checks
+includes: [testTypedArray.js]
+features: [TypedArray, TypedArray.prototype.at, resizable-arraybuffer]
+---*/
+
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'implements TypedArray.prototype.at'
+);
+
+assert.sameValue(
+ typeof ArrayBuffer.prototype.resize,
+ 'function',
+ 'implements ArrayBuffer.prototype.resize'
+);
+
+testWithTypedArrayConstructors(TA => {
+ var BPE = TA.BYTES_PER_ELEMENT;
+ var ab = new ArrayBuffer(BPE * 4, {maxByteLength: BPE * 5});
+ var array = new TA(ab, BPE, 2);
+
+ try {
+ ab.resize(BPE * 5);
+ } catch (_) {}
+
+ // no error following grow:
+ array.at(0);
+
+ try {
+ ab.resize(BPE * 3);
+ } catch (_) {}
+
+ // no error following shrink (within bounds):
+ array.at(0);
+
+ var expectedError;
+ try {
+ ab.resize(BPE * 2);
+ // If the preceding "resize" operation is successful, the typed array will
+ // be out out of bounds, so the subsequent prototype method should produce
+ // a TypeError due to the semantics of ValidateTypedArray.
+ expectedError = TypeError;
+ } catch (_) {
+ // The host is permitted to fail any "resize" operation at its own
+ // discretion. If that occurs, the at operation should complete
+ // successfully.
+ expectedError = Test262Error;
+ }
+
+ assert.throws(expectedError, () => {
+ array.at(0);
+ throw new Test262Error('at completed successfully');
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/return-abrupt-from-this.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/return-abrupt-from-this.js
new file mode 100644
index 0000000000..aaf89b12ef
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/return-abrupt-from-this.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: >
+ Return abrupt from ToObject(this value).
+info: |
+ %TypedArray%.prototype.at( index )
+
+ Let O be the this value.
+ Perform ? ValidateTypedArray(O).
+
+includes: [testTypedArray.js]
+features: [TypedArray,TypedArray.prototype.at]
+---*/
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'The value of `typeof TypedArray.prototype.at` is "function"'
+);
+
+assert.throws(TypeError, () => {
+ TypedArray.prototype.at.call(undefined);
+}, '`TypedArray.prototype.at.call(undefined)` throws TypeError');
+
+assert.throws(TypeError, () => {
+ TypedArray.prototype.at.call(null);
+}, '`TypedArray.prototype.at.call(null)` throws TypeError');
+
+testWithTypedArrayConstructors(TA => {
+ assert.sameValue(typeof TA.prototype.at, 'function', 'The value of `typeof TA.prototype.at` is "function"');
+
+ assert.throws(TypeError, () => {
+ TA.prototype.at.call(undefined);
+ }, '`TA.prototype.at.call(undefined)` throws TypeError');
+
+ assert.throws(TypeError, () => {
+ TA.prototype.at.call(null);
+ }, '`TA.prototype.at.call(null)` throws TypeError');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-item-relative-index.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-item-relative-index.js
new file mode 100644
index 0000000000..ff4d81fc04
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-item-relative-index.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: >
+ Returns the item value at the specified relative index
+info: |
+ %TypedArray%.prototype.at( index )
+
+ Let O be the this value.
+ Perform ? ValidateTypedArray(O).
+ Let len be O.[[ArrayLength]].
+ Let relativeIndex be ? ToInteger(index).
+ If relativeIndex ≥ 0, then
+ Let k be relativeIndex.
+ Else,
+ Let k be len + relativeIndex.
+ If k < 0 or k ≥ len, then return undefined.
+ Return ? Get(O, ! ToString(k)).
+
+includes: [testTypedArray.js]
+features: [TypedArray,TypedArray.prototype.at]
+---*/
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'The value of `typeof TypedArray.prototype.at` is "function"'
+);
+
+testWithTypedArrayConstructors(TA => {
+ let a = new TA([1, 2, 3, 4, 5]);
+ assert.sameValue(a.at(0), 1, 'a.at(0) must return 1');
+ assert.sameValue(a.at(-1), 5, 'a.at(-1) must return 5');
+ assert.sameValue(a.at(-2), 4, 'a.at(-2) must return 4');
+ assert.sameValue(a.at(-3), 3, 'a.at(-3) must return 3');
+ assert.sameValue(a.at(-4), 2, 'a.at(-4) must return 2');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-item.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-item.js
new file mode 100644
index 0000000000..77ac1a0317
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-item.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: >
+ Returns the item value at the specified index
+info: |
+ %TypedArray%.prototype.at( index )
+
+ Let O be the this value.
+ Perform ? ValidateTypedArray(O).
+ Let len be O.[[ArrayLength]].
+ Let relativeIndex be ? ToInteger(index).
+ If relativeIndex ≥ 0, then
+ Let k be relativeIndex.
+ Else,
+ Let k be len + relativeIndex.
+ If k < 0 or k ≥ len, then return undefined.
+ Return ? Get(O, ! ToString(k)).
+
+includes: [testTypedArray.js]
+features: [TypedArray,TypedArray.prototype.at]
+---*/
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'The value of `typeof TypedArray.prototype.at` is "function"'
+);
+
+testWithTypedArrayConstructors(TA => {
+ assert.sameValue(typeof TA.prototype.at, 'function', 'The value of `typeof TA.prototype.at` is "function"');
+ let a = new TA([1, 2, 3, 4]);
+
+ assert.sameValue(a.at(0), 1, 'a.at(0) must return 1');
+ assert.sameValue(a.at(1), 2, 'a.at(1) must return 2');
+ assert.sameValue(a.at(2), 3, 'a.at(2) must return 3');
+ assert.sameValue(a.at(3), 4, 'a.at(3) must return 4');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-undefined-for-holes-in-sparse-arrays.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-undefined-for-holes-in-sparse-arrays.js
new file mode 100644
index 0000000000..c4eafb1e10
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-undefined-for-holes-in-sparse-arrays.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: >
+ Returns the item value at the specified index, holes are filled in sparse arrays.
+info: |
+ %TypedArray%.prototype.at( index )
+
+ Let O be the this value.
+ Perform ? ValidateTypedArray(O).
+ Let len be O.[[ArrayLength]].
+ Let relativeIndex be ? ToInteger(index).
+ If relativeIndex ≥ 0, then
+ Let k be relativeIndex.
+ Else,
+ Let k be len + relativeIndex.
+ If k < 0 or k ≥ len, then return undefined.
+ Return ? Get(O, ! ToString(k)).
+
+includes: [testTypedArray.js]
+features: [TypedArray, TypedArray.prototype.at]
+---*/
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'The value of `typeof TypedArray.prototype.at` is "function"'
+);
+
+testWithTypedArrayConstructors(TA => {
+ let a = new TA([0, 1, , 3, 4, , 6]);
+ let filler = 0;
+ if (TA.name.startsWith('Float')) {
+ filler = NaN;
+ }
+ assert.sameValue(a.at(0), 0, 'a.at(0) must return 0');
+ assert.sameValue(a.at(1), 1, 'a.at(1) must return 1');
+ assert.sameValue(a.at(2), filler, 'a.at(2) must return the value of filler');
+ assert.sameValue(a.at(3), 3, 'a.at(3) must return 3');
+ assert.sameValue(a.at(4), 4, 'a.at(4) must return 4');
+ assert.sameValue(a.at(5), filler, 'a.at(5) must return the value of filler');
+ assert.sameValue(a.at(6), 6, 'a.at(6) must return 6');
+ assert.sameValue(a.at(-0), 0, 'a.at(-0) must return 0');
+ assert.sameValue(a.at(-1), 6, 'a.at(-1) must return 6');
+ assert.sameValue(a.at(-2), filler, 'a.at(-2) must return the value of filler');
+ assert.sameValue(a.at(-3), 4, 'a.at(-3) must return 4');
+ assert.sameValue(a.at(-4), 3, 'a.at(-4) must return 3');
+ assert.sameValue(a.at(-5), filler, 'a.at(-5) must return the value of filler');
+ assert.sameValue(a.at(-6), 1, 'a.at(-6) must return 1');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-undefined-for-out-of-range-index.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-undefined-for-out-of-range-index.js
new file mode 100644
index 0000000000..8a954e3971
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/returns-undefined-for-out-of-range-index.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.at
+description: >
+ Returns undefined if the specified index less than or greater than the available index range.
+info: |
+ %TypedArray%.prototype.at( index )
+
+ If k < 0 or k ≥ len, then return undefined.
+
+includes: [testTypedArray.js]
+features: [TypedArray,TypedArray.prototype.at]
+---*/
+assert.sameValue(
+ typeof TypedArray.prototype.at,
+ 'function',
+ 'The value of `typeof TypedArray.prototype.at` is "function"'
+);
+
+testWithTypedArrayConstructors(TA => {
+ assert.sameValue(typeof TA.prototype.at, 'function', 'The value of `typeof TA.prototype.at` is "function"');
+ let a = new TA([]);
+
+ assert.sameValue(a.at(-2), undefined, 'a.at(-2) must return undefined'); // wrap around the end
+ assert.sameValue(a.at(0), undefined, 'a.at(0) must return undefined');
+ assert.sameValue(a.at(1), undefined, 'a.at(1) must return undefined');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/at/shell.js b/js/src/tests/test262/built-ins/TypedArray/prototype/at/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArray/prototype/at/shell.js