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
This commit is contained in:
Iain Ireland 2020-05-20 19:28:08 +00:00
Родитель c1f2ccff80
Коммит 9e468ae39d
5 изменённых файлов: 19 добавлений и 18 удалений

Просмотреть файл

@ -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();

Просмотреть файл

@ -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);

Просмотреть файл

@ -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 };

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;