From 6e7832790c36b320880f4b6d38dc31388d1fae3a Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 2 Feb 2024 12:07:56 -0800 Subject: [PATCH] [Tests] add test coverage See https://github.com/tc39/test262/pull/4000 --- test/tests.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/tests.js b/test/tests.js index 5f0bf7f..e3a99b2 100644 --- a/test/tests.js +++ b/test/tests.js @@ -40,4 +40,22 @@ module.exports = function (flatMap, t) { st.end(); }); + + t.test('test262: staging test from v8', function (st) { + var arr1 = [0, 1, 2, 3]; + var f = function (e) { + arr1[4] = 42; + return e; + }; + st.deepEqual(flatMap(arr1, f), [0, 1, 2, 3]); + + var arr2 = [0, 1, 2, 3]; + var g = function (e) { + arr2.length = 3; + return e; + }; + st.deepEqual(flatMap(arr2, g), [0, 1, 2]); + + st.end(); + }); };