tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

non-unicode-property-names.js (970B)


      1 // Copyright 2017 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: Exotic named group names in non-Unicode RegExps
      6 esid: prod-GroupSpecifier
      7 features: [regexp-named-groups]
      8 ---*/
      9 
     10 assert.sameValue("a", /(?<π>a)/.exec("bab").groups.π);
     11 assert.sameValue("a", /(?<π>a)/.exec("bab").groups.\u03C0);
     12 assert.sameValue("a", /(?<$>a)/.exec("bab").groups.$);
     13 assert.sameValue("a", /(?<_>a)/.exec("bab").groups._);
     14 assert.sameValue("a", /(?<_\u200C>a)/.exec("bab").groups._\u200C);
     15 assert.sameValue("a", /(?<_\u200D>a)/.exec("bab").groups._\u200D);
     16 assert.sameValue("a", /(?<ಠ_ಠ>a)/.exec("bab").groups.ಠ_ಠ);
     17 
     18 // Unicode escapes in capture names.
     19 assert(/(?<\u0041>.)/.test("a"));
     20 assert(RegExp("(?<\u{0041}>.)").test("a"), "Non-surrogate");
     21 
     22 // 4-char escapes must be the proper ID_Start/ID_Continue
     23 assert(RegExp("(?<\\u0041>.)").test("a"), "Non-surrogate");
     24 
     25 reportCompare(0, 0);