diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/jit-test/tests/regexp/atom-match-unicode-split-surrogate.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/regexp/atom-match-unicode-split-surrogate.js')
-rw-r--r-- | js/src/jit-test/tests/regexp/atom-match-unicode-split-surrogate.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/regexp/atom-match-unicode-split-surrogate.js b/js/src/jit-test/tests/regexp/atom-match-unicode-split-surrogate.js new file mode 100644 index 0000000000..3c1909fcf2 --- /dev/null +++ b/js/src/jit-test/tests/regexp/atom-match-unicode-split-surrogate.js @@ -0,0 +1,25 @@ +function test(flags) { + // RegExp with a simple atom matcher. + // - Global flag to enable setting 'lastIndex'. + let s = "\u{10000}"; + let re = RegExp(s, flags + "g"); + + for (let i = 0; i < 200; ++i) { + // Set lastIndex in the middle of the surrogate pair. + re.lastIndex = 1; + + // |exec| will reset lastIndex to the start of the surrogate pair. + let r = re.exec(s); + + // Atom match should succeed. + assertEq(r[0], s); + assertEq(r.index, 0); + assertEq(re.lastIndex, 2); + } +} + +// Unicode flag to enable surrogate pairs support. +test("u"); + +// Unicode-Sets flag to enable surrogate pairs support. +test("v"); |