tor-browser

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

non-unicode-property-names-invalid.js (1359B)


      1 // Copyright (C) 2020 Apple Inc. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 author: Michael Saboff
      5 description: Invalid exotic named group names in non-Unicode RegExps
      6 esid: prod-GroupSpecifier
      7 features: [regexp-named-groups]
      8 ---*/
      9 
     10 /*
     11 Valid ID_Continue Unicode characters (Can't be first identifier character.)
     12 
     13 𝟚  \u{1d7da}  \ud835 \udfda
     14 
     15 Invalid ID_Start / ID_Continue
     16 
     17 (fox face emoji) 🦊  \u{1f98a}  \ud83e \udd8a
     18 (dog emoji)  πŸ•  \u{1f415}  \ud83d \udc15
     19 */
     20 
     21 assert.throws(SyntaxError, function() {
     22    return new RegExp("(?<🦊>fox)");
     23 });
     24 
     25 assert.throws(SyntaxError, function() {
     26    return new RegExp("(?<\u{1f98a}>fox)");
     27 });
     28 
     29 assert.throws(SyntaxError, function() {
     30    return new RegExp("(?<\ud83e\udd8a>fox)");
     31 });
     32 
     33 assert.throws(SyntaxError, function() {
     34    return new RegExp("(?<πŸ•>dog)");
     35 });
     36 
     37 assert.throws(SyntaxError, function() {
     38    return new RegExp("(?<\u{1f415}>dog)");
     39 });
     40 
     41 assert.throws(SyntaxError, function() {
     42    return new RegExp("(?<\ud83d \udc15>dog)");
     43 });
     44 
     45 assert.throws(SyntaxError, function() {
     46    return new RegExp("(?<𝟚the>the)");
     47 });
     48 
     49 assert.throws(SyntaxError, function() {
     50    return new RegExp("(?<\u{1d7da}the>the)");
     51 });
     52 
     53 assert.throws(SyntaxError, function() {
     54    return new RegExp("(?<\ud835\udfdathe>the)");
     55 });
     56 
     57 reportCompare(0, 0);