summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/named-groups/non-unicode-property-names.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/named-groups/non-unicode-property-names.js')
-rw-r--r--js/src/tests/test262/built-ins/RegExp/named-groups/non-unicode-property-names.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/named-groups/non-unicode-property-names.js b/js/src/tests/test262/built-ins/RegExp/named-groups/non-unicode-property-names.js
new file mode 100644
index 0000000000..e9b3cabb4d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/RegExp/named-groups/non-unicode-property-names.js
@@ -0,0 +1,25 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Exotic named group names in non-Unicode RegExps
+esid: prod-GroupSpecifier
+features: [regexp-named-groups]
+---*/
+
+assert.sameValue("a", /(?<π>a)/.exec("bab").groups.π);
+assert.sameValue("a", /(?<π>a)/.exec("bab").groups.\u03C0);
+assert.sameValue("a", /(?<$>a)/.exec("bab").groups.$);
+assert.sameValue("a", /(?<_>a)/.exec("bab").groups._);
+assert.sameValue("a", /(?<_\u200C>a)/.exec("bab").groups._\u200C);
+assert.sameValue("a", /(?<_\u200D>a)/.exec("bab").groups._\u200D);
+assert.sameValue("a", /(?<ಠ_ಠ>a)/.exec("bab").groups.ಠ_ಠ);
+
+// Unicode escapes in capture names.
+assert(/(?<\u0041>.)/.test("a"));
+assert(RegExp("(?<\u{0041}>.)").test("a"), "Non-surrogate");
+
+// 4-char escapes must be the proper ID_Start/ID_Continue
+assert(RegExp("(?<\\u0041>.)").test("a"), "Non-surrogate");
+
+reportCompare(0, 0);