mirror of https://github.com/tc39/test262.git
[test262] Add a new staging test for Array.p.flatMap
Bug: v8:14306 Change-Id: Ibc7a04288a0c31bfcf601aa864e02b6c067045c2 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5259306 Reviewed-by: Shu-yu Guo <syg@chromium.org> Commit-Queue: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/heads/main@{#92174}
This commit is contained in:
parent
3e7938c1f5
commit
f742eb092d
28
test/staging/built-ins/Array/prototype/flatMap/callback-with-side-effects.js
vendored
Normal file
28
test/staging/built-ins/Array/prototype/flatMap/callback-with-side-effects.js
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// 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]);
|
||||||
|
})();
|
Loading…
Reference in New Issue