tor-browser

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

unicode-property-names.js (1535B)


      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 Unicode RegExps
      6 esid: prod-GroupSpecifier
      7 features: [regexp-named-groups]
      8 ---*/
      9 
     10 assert.sameValue("a", /(?<π>a)/u.exec("bab").groups.π);
     11 assert.sameValue("a", /(?<\u{03C0}>a)/u.exec("bab").groups.π);
     12 assert.sameValue("a", /(?<π>a)/u.exec("bab").groups.\u03C0);
     13 assert.sameValue("a", /(?<\u{03C0}>a)/u.exec("bab").groups.\u03C0);
     14 assert.sameValue("a", /(?<$>a)/u.exec("bab").groups.$);
     15 assert.sameValue("a", /(?<_>a)/u.exec("bab").groups._);
     16 assert.sameValue("a", /(?<$𐒤>a)/u.exec("bab").groups.$𐒤);
     17 assert.sameValue("a", /(?<_\u200C>a)/u.exec("bab").groups._\u200C);
     18 assert.sameValue("a", /(?<_\u200D>a)/u.exec("bab").groups._\u200D);
     19 assert.sameValue("a", /(?<ಠ_ಠ>a)/u.exec("bab").groups.ಠ_ಠ);
     20 
     21 // Unicode escapes in capture names.
     22 assert(/(?<a\uD801\uDCA4>.)/u.test("a"), "\\u Lead \\u Trail");
     23 assert(/(?<\u0041>.)/u.test("a"), "\\u NonSurrogate");
     24 assert(/(?<\u{0041}>.)/u.test("a"), "\\u{ Non-surrogate }");
     25 assert(/(?<a\u{104A4}>.)/u.test("a"), "\\u{ Surrogate, ID_Continue }");
     26 assert(RegExp("(?<\u{0041}>.)", "u").test("a"), "Non-surrogate");
     27 assert(RegExp("(?<a\u{104A4}>.)", "u").test("a"), "Surrogate,ID_Continue");
     28 assert((/(?<\u{0041}>.)/u).test("a"), "Non-surrogate");
     29 assert(/(?<a\u{104A4}>.)/u.test("a"), "Surrogate, ID_Continue");
     30 assert(RegExp("(?<\\u0041>.)", "u").test("a"), "Non-surrogate");
     31 
     32 reportCompare(0, 0);