tor-browser

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

escaped-solidus-character-simple.js (933B)


      1 // Copyright (C) 2024 Leo Balter. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-regexp.escape
      6 description: Escaped U+002F (SOLIDUS) character (simple assertions)
      7 info: |
      8  EncodeForRegExpEscape ( c )
      9 
     10  1. If c is matched by SyntaxCharacter or c is U+002F (SOLIDUS), then
     11    a. Return the string-concatenation of 0x005C (REVERSE SOLIDUS) and UTF16EncodeCodePoint(c).
     12 features: [RegExp.escape]
     13 ---*/
     14 
     15 assert.sameValue(RegExp.escape('/'), '\\/', 'solidus character is escaped correctly');
     16 assert.sameValue(RegExp.escape('//'), '\\/\\/', 'solidus character is escaped correctly - multiple occurrences 1');
     17 assert.sameValue(RegExp.escape('///'), '\\/\\/\\/', 'solidus character is escaped correctly - multiple occurrences 2');
     18 assert.sameValue(RegExp.escape('////'), '\\/\\/\\/\\/', 'solidus character is escaped correctly - multiple occurrences 3');
     19 
     20 reportCompare(0, 0);