tor-browser

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

two.js (3006B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-unescape-string
      5 es6id: B.2.1.2
      6 description: Translation of patterns with two digits
      7 info: |
      8    [...]
      9    5. Repeat, while k ≠ length,
     10       [...]
     11       a. Let c be the code unit at index k within string.
     12       b. If c is %, then
     13          [...]
     14          ii. Else if k ≤ length-3 and the two code units at indices k+1 and
     15              k+2 within string are both hexadecimal digits, then
     16              1. Let c be the code unit whose value is the integer represented
     17                 by two zeroes plus the two hexadecimal digits at indices k+1
     18                 and k+2 within string.
     19              2. Increase k by 2.
     20       [...]
     21 ---*/
     22 
     23 assert.sameValue(unescape('%0%0000'), '%0\x0000', '%00');
     24 assert.sameValue(unescape('%0%0100'), '%0\x0100', '%01');
     25 
     26 assert.sameValue(unescape('%0%2900'), '%0)00', '%29');
     27 assert.sameValue(unescape('%0%2a00'), '%0*00', '%2a');
     28 assert.sameValue(unescape('%0%2A00'), '%0*00', '%2A');
     29 assert.sameValue(unescape('%0%2b00'), '%0+00', '%2b');
     30 assert.sameValue(unescape('%0%2B00'), '%0+00', '%2B');
     31 assert.sameValue(unescape('%0%2c00'), '%0,00', '%2c');
     32 assert.sameValue(unescape('%0%2C00'), '%0,00', '%2C');
     33 assert.sameValue(unescape('%0%2d00'), '%0-00', '%2d');
     34 assert.sameValue(unescape('%0%2D00'), '%0-00', '%2D');
     35 
     36 assert.sameValue(unescape('%0%3900'), '%0900', '%39');
     37 assert.sameValue(unescape('%0%3a00'), '%0:00', '%3A');
     38 assert.sameValue(unescape('%0%3A00'), '%0:00', '%3A');
     39 
     40 assert.sameValue(unescape('%0%3f00'), '%0?00', '%3f');
     41 assert.sameValue(unescape('%0%3F00'), '%0?00', '%3F');
     42 assert.sameValue(unescape('%0%4000'), '%0@00', '%40');
     43 
     44 assert.sameValue(unescape('%0%5a00'), '%0Z00', '%5a');
     45 assert.sameValue(unescape('%0%5A00'), '%0Z00', '%5A');
     46 assert.sameValue(unescape('%0%5b00'), '%0[00', '%5b');
     47 assert.sameValue(unescape('%0%5B00'), '%0[00', '%5B');
     48 
     49 assert.sameValue(unescape('%0%5e00'), '%0^00', '%5e');
     50 assert.sameValue(unescape('%0%5E00'), '%0^00', '%5E');
     51 assert.sameValue(unescape('%0%5f00'), '%0_00', '%5f');
     52 assert.sameValue(unescape('%0%5F00'), '%0_00', '%5F');
     53 assert.sameValue(unescape('%0%6000'), '%0`00', '%60');
     54 assert.sameValue(unescape('%0%6100'), '%0a00', '%61');
     55 
     56 assert.sameValue(unescape('%0%7a00'), '%0z00', '%7a');
     57 assert.sameValue(unescape('%0%7A00'), '%0z00', '%7A');
     58 assert.sameValue(unescape('%0%7b00'), '%0{00', '%7b');
     59 assert.sameValue(unescape('%0%7B00'), '%0{00', '%7B');
     60 
     61 assert.sameValue(unescape('%0%fe00'), '%0\xfe00', '%fe');
     62 assert.sameValue(unescape('%0%Fe00'), '%0\xfe00', '%Fe');
     63 assert.sameValue(unescape('%0%fE00'), '%0\xfe00', '%fE');
     64 assert.sameValue(unescape('%0%FE00'), '%0\xfe00', '%FE');
     65 
     66 assert.sameValue(unescape('%0%ff00'), '%0\xff00', '%ff');
     67 assert.sameValue(unescape('%0%Ff00'), '%0\xff00', '%Ff');
     68 assert.sameValue(unescape('%0%fF00'), '%0\xff00', '%fF');
     69 assert.sameValue(unescape('%0%FF00'), '%0\xff00', '%FF');
     70 
     71 reportCompare(0, 0);