From 9e468ae39dec4d062bd85ffaa5ac120062519d2c Mon Sep 17 00:00:00 2001 From: Iain Ireland Date: Wed, 20 May 2020 19:28:08 +0000 Subject: [PATCH] Bug 1362154: Part 11: Update expectations for existing tests r=mgaudet We have a number of tests that expect a particular set of properties on regexp results, which need to be updated now that they have a (generally undefined) `groups` property. Depends on D76045 Differential Revision: https://phabricator.services.mozilla.com/D76046 --- js/src/tests/non262/RegExp/replace-trace.js | 30 +++++++++---------- js/src/tests/non262/String/match-GetMethod.js | 1 + js/src/tests/non262/object/15.2.3.14-01.js | 2 +- js/src/tests/non262/object/entries.js | 2 +- js/src/tests/non262/object/values.js | 2 +- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/js/src/tests/non262/RegExp/replace-trace.js b/js/src/tests/non262/RegExp/replace-trace.js index 73e6235634b8..1093bc6850eb 100644 --- a/js/src/tests/non262/RegExp/replace-trace.js +++ b/js/src/tests/non262/RegExp/replace-trace.js @@ -102,7 +102,7 @@ assertEq(log, "get:exec,call:exec," + "get:result[0]," + "get:exec,call:exec," + - "get:result[length],get:result[0],get:result[index],"); + "get:result[length],get:result[0],get:result[index],get:result[groups],"); // Trace global with empty match. reset(); @@ -120,7 +120,7 @@ assertEq(log, "get:result[0]," + "get:lastIndex,set:lastIndex," + "get:exec,call:exec," + - "get:result[length],get:result[0],get:result[index],"); + "get:result[length],get:result[0],get:result[index],get:result[groups],"); // Trace global and unicode with empty match. // 1. not surrogate pair @@ -158,11 +158,11 @@ assertEq(log, "get:result[0]," + "get:lastIndex,set:lastIndex," + "get:exec,call:exec," + - "get:result[length],get:result[0],get:result[index]," + - "get:result[length],get:result[0],get:result[index]," + - "get:result[length],get:result[0],get:result[index]," + - "get:result[length],get:result[0],get:result[index]," + - "get:result[length],get:result[0],get:result[index],"); + "get:result[length],get:result[0],get:result[index],get:result[groups]," + + "get:result[length],get:result[0],get:result[index],get:result[groups]," + + "get:result[length],get:result[0],get:result[index],get:result[groups]," + + "get:result[length],get:result[0],get:result[index],get:result[groups]," + + "get:result[length],get:result[0],get:result[index],get:result[groups],"); // Trace global with captures and substitutions. reset(); @@ -180,7 +180,7 @@ assertEq(log, "get:result[0]," + "get:exec,call:exec," + "get:result[length],get:result[0],get:result[index]," + - "get:result[1],get:result[2],"); + "get:result[1],get:result[2],get:result[groups],"); // Trace global with empty match and captures and substitutions, // with different matched. @@ -200,7 +200,7 @@ assertEq(log, "get:lastIndex,set:lastIndex," + "get:exec,call:exec," + "get:result[length],get:result[0],get:result[index]," + - "get:result[1],get:result[2],"); + "get:result[1],get:result[2],get:result[groups],"); // Trace global with empty match and captures and function, // with different matched. @@ -231,7 +231,7 @@ assertEq(log, "get:lastIndex,set:lastIndex," + "get:exec,call:exec," + "get:result[length],get:result[0],get:result[index]," + - "get:result[1],get:result[2]," + + "get:result[1],get:result[2],get:result[groups]," + "call:replaceFunc,"); // Trace global with non-empty match, move backwards. @@ -252,8 +252,8 @@ assertEq(log, "get:exec,call:exec," + "get:result[0]," + "get:exec,call:exec," + - "get:result[length],get:result[0],get:result[index]," + - "get:result[length],get:result[0],get:result[index],"); + "get:result[length],get:result[0],get:result[index],get:result[groups]," + + "get:result[length],get:result[0],get:result[index],get:result[groups],"); // Trace global with non-empty match, position + matchLength overflows. reset(); @@ -270,7 +270,7 @@ assertEq(log, "get:exec,call:exec," + "get:result[0]," + "get:exec,call:exec," + - "get:result[length],get:result[0],get:result[index],"); + "get:result[length],get:result[0],get:result[index],get:result[groups],"); // Trace global with non-empty match, position overflows. reset(); @@ -287,7 +287,7 @@ assertEq(log, "get:exec,call:exec," + "get:result[0]," + "get:exec,call:exec," + - "get:result[length],get:result[0],get:result[index],"); + "get:result[length],get:result[0],get:result[index],get:result[groups],"); // Trace non-global. reset(); @@ -301,7 +301,7 @@ assertEq(ret, "a_XYZ_AbcABC"); assertEq(log, "get:global," + "get:exec,call:exec," + - "get:result[length],get:result[0],get:result[index],"); + "get:result[length],get:result[0],get:result[index],get:result[groups],"); stopObserve(); diff --git a/js/src/tests/non262/String/match-GetMethod.js b/js/src/tests/non262/String/match-GetMethod.js index 70e89bb7e2ee..85a9822d8f91 100644 --- a/js/src/tests/non262/String/match-GetMethod.js +++ b/js/src/tests/non262/String/match-GetMethod.js @@ -15,6 +15,7 @@ function create(value) { var expected = ["-"]; expected.index = 1; expected.input = "a-a"; +expected.groups = undefined; for (let v of [null, undefined]) { assertDeepEq("a-a".match(create(v)), expected); diff --git a/js/src/tests/non262/object/15.2.3.14-01.js b/js/src/tests/non262/object/15.2.3.14-01.js index 1a92bf324999..6cb8965a6c9e 100644 --- a/js/src/tests/non262/object/15.2.3.14-01.js +++ b/js/src/tests/non262/object/15.2.3.14-01.js @@ -55,7 +55,7 @@ assertEq(arraysEqual(keys, ["0", "1", "2"]), true, o = /./.exec("abc"); keys = Object.keys(o); -assertEq(arraysEqual(keys, ["0", "index", "input"]), true, +assertEq(arraysEqual(keys, ["0", "index", "input", "groups"]), true, "" + keys); o = { a: 1, b: 2, c: 3 }; diff --git a/js/src/tests/non262/object/entries.js b/js/src/tests/non262/object/entries.js index 342cfa1a1413..1a03ceb42182 100644 --- a/js/src/tests/non262/object/entries.js +++ b/js/src/tests/non262/object/entries.js @@ -32,7 +32,7 @@ if ("entries" in Object) { o = /./.exec("abc"); entries = Object.entries(o); - assertDeepEq(entries, [["0", "a"], ["index", 0], ["input", "abc"]]); + assertDeepEq(entries, [["0", "a"], ["index", 0], ["input", "abc"], ["groups", undefined]]); o = { a: 1, b: 2, c: 3 }; delete o.b; diff --git a/js/src/tests/non262/object/values.js b/js/src/tests/non262/object/values.js index 7f2a7464efcd..189bea76050a 100644 --- a/js/src/tests/non262/object/values.js +++ b/js/src/tests/non262/object/values.js @@ -32,7 +32,7 @@ if ("values" in Object) { o = /./.exec("abc"); values = Object.values(o); - assertDeepEq(values, ["a", 0, "abc"]); + assertDeepEq(values, ["a", 0, "abc", undefined]); o = { a: 1, b: 2, c: 3 }; delete o.b;