tor-browser

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

regexp-class-chars.js (941B)


      1 // Copyright (C) 2019 Mike Pennisi. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: RegularExpressionClassChars may include the forward slash character
      6 info: |
      7  11.8.5Regular Expression Literals
      8 
      9  RegularExpressionClass ::
     10    [ RegularExpressionClassChars ]
     11 
     12  RegularExpressionClassChars ::
     13    [empty]
     14    RegularExpressionClassChars RegularExpressionClassChar
     15 
     16  RegularExpressionClassChar ::
     17    RegularExpressionNonTerminator but not one of ] or \
     18    RegularExpressionBackslashSequence
     19 
     20  RegularExpressionNonTerminator ::
     21    SourceCharacterbut not LineTerminator
     22 esid: sec-literals-regular-expression-literals
     23 ---*/
     24 
     25 assert(/[/]/.test("/"), "Forward slash");
     26 assert.sameValue(/[/]/.test("x"), false, "Forward slash");
     27 
     28 assert(/[//]/.test("/"), "Forward slash - repeated");
     29 assert.sameValue(/[//]/.test("x"), false, "Forward slash - repeated");
     30 
     31 reportCompare(0, 0);