summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/from/source-array-boundary.js
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/Array/from/source-array-boundary.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/from/source-array-boundary.js')
-rw-r--r--js/src/tests/test262/built-ins/Array/from/source-array-boundary.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/from/source-array-boundary.js b/js/src/tests/test262/built-ins/Array/from/source-array-boundary.js
new file mode 100644
index 0000000000..69b35e4003
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/from/source-array-boundary.js
@@ -0,0 +1,30 @@
+// Copyright 2015 Microsoft Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+description: Source array with boundary values
+esid: sec-array.from
+es6id: 22.1.2.1
+---*/
+
+var array = [Number.MAX_VALUE, Number.MIN_VALUE, Number.NaN, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY];
+var arrayIndex = -1;
+
+function mapFn(value, index) {
+ this.arrayIndex++;
+ assert.sameValue(value, array[this.arrayIndex], 'The value of value is expected to equal the value of array[this.arrayIndex]');
+ assert.sameValue(index, this.arrayIndex, 'The value of index is expected to equal the value of this.arrayIndex');
+
+ return value;
+}
+
+var a = Array.from(array, mapFn, this);
+
+assert.sameValue(a.length, array.length, 'The value of a.length is expected to equal the value of array.length');
+assert.sameValue(a[0], Number.MAX_VALUE, 'The value of a[0] is expected to equal the value of Number.MAX_VALUE');
+assert.sameValue(a[1], Number.MIN_VALUE, 'The value of a[1] is expected to equal the value of Number.MIN_VALUE');
+assert.sameValue(a[2], Number.NaN, 'The value of a[2] is expected to equal the value of Number.NaN');
+assert.sameValue(a[3], Number.NEGATIVE_INFINITY, 'The value of a[3] is expected to equal the value of Number.NEGATIVE_INFINITY');
+assert.sameValue(a[4], Number.POSITIVE_INFINITY, 'The value of a[4] is expected to equal the value of Number.POSITIVE_INFINITY');
+
+reportCompare(0, 0);