summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/harmony/regexp-named-captures.js
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-10-22 15:59:07 +0200
committerMichaël Zasso <targos@protonmail.com>2019-10-24 16:13:38 +0200
commitd53dd8b0a00d3e00e97f46ae4ae67afa31c10526 (patch)
tree1f01585b2a8ad6c9abcc85db1004452a6b3a0a02 /deps/v8/test/mjsunit/harmony/regexp-named-captures.js
parenta228e22533260055495c0f592a4785d15282f2fb (diff)
downloadandroid-node-v8-d53dd8b0a00d3e00e97f46ae4ae67afa31c10526.tar.gz
android-node-v8-d53dd8b0a00d3e00e97f46ae4ae67afa31c10526.tar.bz2
android-node-v8-d53dd8b0a00d3e00e97f46ae4ae67afa31c10526.zip
deps: V8: cherry-pick ed40ab1
Original commit message: [regexp] Fix the order of named captures on the groups object Named capture properties on the groups object should be ordered by the capture index (and not alpha-sorted). This was accidentally broken in https://crrev.com/c/1687413. Bug: v8:9822,v8:9423 Change-Id: Iac6f866f077a1b7ce557ba47e8ba5d7e7014b3ce Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1864829 Auto-Submit: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Commit-Queue: Peter Marshall <petermarshall@chromium.org> Cr-Commit-Position: refs/heads/master@{#64306} Refs: https://github.com/v8/v8/commit/ed40ab15830d1a501effd00f4d3ffe66bd9ef97f Fixes: https://github.com/nodejs/node/issues/29878 PR-URL: https://github.com/nodejs/node/pull/30064 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'deps/v8/test/mjsunit/harmony/regexp-named-captures.js')
-rw-r--r--deps/v8/test/mjsunit/harmony/regexp-named-captures.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/harmony/regexp-named-captures.js b/deps/v8/test/mjsunit/harmony/regexp-named-captures.js
index e1fa60dca4..f58bcd9d44 100644
--- a/deps/v8/test/mjsunit/harmony/regexp-named-captures.js
+++ b/deps/v8/test/mjsunit/harmony/regexp-named-captures.js
@@ -419,6 +419,15 @@ function toSlowMode(re) {
assertEquals("cd", "abcd".replace(re, "$<$1>"));
}
+// Named captures are ordered by capture index on the groups object.
+// https://crbug.com/v8/9822
+
+{
+ const r = /(?<BKey>.+)\s(?<AKey>.+)/;
+ const s = 'example string';
+ assertArrayEquals(["BKey", "AKey"], Object.keys(r.exec(s).groups));
+}
+
// Tests for 'groups' semantics on the regexp result object.
// https://crbug.com/v8/7192