fix errors

This commit is contained in:
tannal 2024-10-04 14:13:23 +08:00
parent 5c20b3bd85
commit d7d02aedca
5 changed files with 6 additions and 9 deletions

View File

@ -14,6 +14,8 @@ function doExec(regex) {
return result ? [result[0], result.index] : null;
}
assert.compareArray(doExec(/𠮷/), ["𠮷", 0], "Basic exec without v flag");
assert.compareArray(doExec(/𠮷/u), ["𠮷", 0], "Exec with u flag");
assert.compareArray(doExec(/\p{Script=Han}/u), ["𠮷", 0], "Unicode property escapes with u flag");
assert.compareArray(doExec(/./u), ["𠮷", 0], "Dot with u flag");
@ -43,5 +45,3 @@ assert.sameValue(resultWithGroupsV.index, 0, "Match index for groups with v flag
const complexText = 'a\u{20BB7}b\u{10FFFF}c';
assert.compareArray(/\P{ASCII}/u.exec(complexText), ["\u{20BB7}"], "Non-ASCII with u flag");
assert.compareArray(/\P{ASCII}/v.exec(complexText), ["\u{20BB7}"], "Non-ASCII with v flag");
reportCompare(0, 0);

View File

@ -29,4 +29,4 @@ assert.compareArray(doMatch(/[👨‍👩‍👧‍👦]/u), ["👨"], "Complex
assert.sameValue(doMatch(/x/u), null, "Non-matching regex with u flag");
assert.sameValue(doMatch(/x/v), null, "Non-matching regex with v flag");
reportCompare(0, 0);

View File

@ -4,6 +4,7 @@
esid: sec-regexp.prototype-@@matchall
description: RegExp.prototype[@@matchAll] behavior with 'u'and 'v' flags.
features: [Symbol.matchAll, regexp-v-flag, regexp-unicode-property-escapes]
includes: [compareArray.js]
---*/
const text = '𠮷a𠮷b𠮷';
@ -59,13 +60,13 @@ assert.sameValue(
assert.sameValue(
doMatchAll(/(?:)/gu).length,
6,
12,
"Empty matches with u flag"
);
assert.sameValue(
doMatchAll(/(?:)/gv).length,
6,
12,
"Empty matches with v flag"
);
@ -80,4 +81,3 @@ assert.sameValue(
undefined,
"Non-ASCII with v flag"
);
reportCompare(0, 0);

View File

@ -24,5 +24,3 @@ assert.sameValue(
assert.sameValue(doReplace(/\p{Script=Han}/gu, 'X'), "XaXbX", "Unicode property escapes with u flag");
assert.sameValue(doReplace(/\p{Script=Han}/gv, 'X'), "XaXbX", "Unicode property escapes with v flag");
reportCompare(0, 0);

View File

@ -41,4 +41,3 @@ assert.sameValue(doSearch(/[👨‍👩‍👧‍👦]/u), 9, "Complex emoji seq
// Non-existent pattern
assert.sameValue(doSearch(/x/u), -1, "Search for non-existent pattern with u flag");
assert.sameValue(doSearch(/x/v), -1, "Search for non-existent pattern with v flag");
reportCompare(0, 0);