summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt')
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js50
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js43
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes.js38
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/not-enumerable-keys.js37
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/shell.js42
6 files changed, 210 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js
new file mode 100644
index 0000000000..4aa72e5416
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-and-symbol-keys-.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-integer-indexed-exotic-objects-ownpropertykeys
+description: >
+ Return integer index + non numeric string keys
+info: |
+ 9.4.5.6 [[OwnPropertyKeys]] ()
+
+ ...
+ 3. Let len be the value of O's [[ArrayLength]] internal slot.
+ 4. For each integer i starting with 0 such that i < len, in ascending order,
+ a. Add ! ToString(i) as the last element of keys.
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Reflect, Symbol, TypedArray]
+---*/
+
+var s1 = Symbol("1");
+var s2 = Symbol("2");
+
+TypedArray.prototype[3] = 42;
+TypedArray.prototype.bar = 42;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA([42n, 42n, 42n]);
+ sample1[s1] = 42;
+ sample1[s2] = 42;
+ sample1.test262 = 42;
+ sample1.ecma262 = 42;
+ var result1 = Reflect.ownKeys(sample1);
+ assert(
+ compareArray(result1, ["0", "1", "2", "test262", "ecma262", s1, s2]),
+ "result1"
+ );
+
+ var sample2 = new TA(4).subarray(2);
+ sample2[s1] = 42;
+ sample2[s2] = 42;
+ sample2.test262 = 42;
+ sample2.ecma262 = 42;
+ var result2 = Reflect.ownKeys(sample2);
+ assert(
+ compareArray(result2, ["0", "1", "test262", "ecma262", s1, s2]),
+ "result2"
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js
new file mode 100644
index 0000000000..5867283bf8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes-and-string-keys.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-integer-indexed-exotic-objects-ownpropertykeys
+description: >
+ Return integer index + non numeric string keys
+info: |
+ 9.4.5.6 [[OwnPropertyKeys]] ()
+
+ ...
+ 3. Let len be the value of O's [[ArrayLength]] internal slot.
+ 4. For each integer i starting with 0 such that i < len, in ascending order,
+ a. Add ! ToString(i) as the last element of keys.
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+TypedArray.prototype[3] = 42;
+TypedArray.prototype.bar = 42;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA([42n, 42n, 42n]);
+ sample1.test262 = 42;
+ sample1.ecma262 = 42;
+ var result1 = Reflect.ownKeys(sample1);
+ assert(
+ compareArray(result1, ["0", "1", "2", "test262", "ecma262"]),
+ "result1"
+ );
+
+ var sample2 = new TA(4).subarray(2);
+ sample2.test262 = 42;
+ sample2.ecma262 = 42;
+ var result2 = Reflect.ownKeys(sample2);
+ assert(
+ compareArray(result2, ["0", "1", "test262", "ecma262"]),
+ "result2"
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes.js
new file mode 100644
index 0000000000..596d2d59a1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/integer-indexes.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-integer-indexed-exotic-objects-ownpropertykeys
+description: >
+ Return keys
+info: |
+ 9.4.5.6 [[OwnPropertyKeys]] ()
+
+ ...
+ 3. Let len be the value of O's [[ArrayLength]] internal slot.
+ 4. For each integer i starting with 0 such that i < len, in ascending order,
+ a. Add ! ToString(i) as the last element of keys.
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA([42n, 42n, 42n]);
+ var result1 = Reflect.ownKeys(sample1);
+ assert(compareArray(result1, ["0", "1", "2"]), "result1");
+
+ var sample2 = new TA(4);
+ var result2 = Reflect.ownKeys(sample2);
+ assert(compareArray(result2, ["0", "1", "2", "3"]), "result2");
+
+ var sample3 = new TA(4).subarray(2);
+ var result3 = Reflect.ownKeys(sample3);
+ assert(compareArray(result3, ["0", "1"]), "result3");
+
+ var sample4 = new TA();
+ var result4 = Reflect.ownKeys(sample4);
+ assert(compareArray(result4, []), "result4");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/not-enumerable-keys.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/not-enumerable-keys.js
new file mode 100644
index 0000000000..06439e1441
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/not-enumerable-keys.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-integer-indexed-exotic-objects-ownpropertykeys
+description: >
+ List not-enumerable own keys
+info: |
+ 9.4.5.6 [[OwnPropertyKeys]] ()
+
+ ...
+ 3. Let len be the value of O's [[ArrayLength]] internal slot.
+ 4. For each integer i starting with 0 such that i < len, in ascending order,
+ a. Add ! ToString(i) as the last element of keys.
+ ...
+includes: [testBigIntTypedArray.js, compareArray.js]
+features: [BigInt, Reflect, Symbol, TypedArray]
+---*/
+
+var s = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ Object.defineProperty(sample, s, {
+ value: 42,
+ enumerable: false
+ });
+ Object.defineProperty(sample, "test262", {
+ value: 42,
+ enumerable: false
+ });
+ var result = Reflect.ownKeys(sample);
+ assert(compareArray(result, ["test262", s]));
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/BigInt/shell.js
new file mode 100644
index 0000000000..90ee9c114d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/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;
+ }
+ }
+}