tor-browser

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

RegExp-invalid-control-escape-character-class-range.js (616B)


      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 esid: prod-annexB-ClassAtomNoDash
      6 description: >
      7  Invalid \c in a range behaves like [\\c-_]
      8 info: |
      9  ClassAtomNoDash :: `\`
     10 
     11  The production ClassAtomNoDash :: `\` evaluates as follows:
     12    1. Return the CharSet containing the single character `\`.
     13 ---*/
     14 
     15 let re = /[\\c-f]/
     16 
     17 assert(re.test("\\"))
     18 assert(!re.test("b"))
     19 assert(re.test("c"))
     20 assert(re.test("d"))
     21 assert(re.test("e"))
     22 assert(re.test("f"))
     23 assert(!re.test("g"))
     24 assert(!re.test("-"))
     25 
     26 reportCompare(0, 0);