diff options
Diffstat (limited to 'js/src/tests/test262/staging/built-ins/Array/prototype/flatMap')
3 files changed, 30 insertions, 0 deletions
diff --git a/js/src/tests/test262/staging/built-ins/Array/prototype/flatMap/browser.js b/js/src/tests/test262/staging/built-ins/Array/prototype/flatMap/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/staging/built-ins/Array/prototype/flatMap/browser.js diff --git a/js/src/tests/test262/staging/built-ins/Array/prototype/flatMap/callback-with-side-effects.js b/js/src/tests/test262/staging/built-ins/Array/prototype/flatMap/callback-with-side-effects.js new file mode 100644 index 0000000000..83d2057623 --- /dev/null +++ b/js/src/tests/test262/staging/built-ins/Array/prototype/flatMap/callback-with-side-effects.js @@ -0,0 +1,30 @@ +// Copyright (C) 2024 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.prototype.flatMap +description: > + Array.prototype.flatMap is given a callback that modifies the array being + iterated. +includes: [compareArray.js] +---*/ + +(function TestGrow() { + let array = [0,1,2,3]; + function f(e) { + array[4] = 42; + return e; + } + assert.compareArray(array.flatMap(f), [0,1,2,3]); +})(); + +(function TestShrink() { + let array = [0,1,2,3]; + function f(e) { + array.length = 3; + return e; + } + assert.compareArray(array.flatMap(f), [0,1,2]); +})(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/staging/built-ins/Array/prototype/flatMap/shell.js b/js/src/tests/test262/staging/built-ins/Array/prototype/flatMap/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/staging/built-ins/Array/prototype/flatMap/shell.js |