tor-browser

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

escape-above.js (976B)


      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-escape-string
      5 es6id: B.2.1.1
      6 description: Escaping of code units above 255
      7 info: |
      8    [...]
      9    5. Repeat, while k < length,
     10       a. Let char be the code unit (represented as a 16-bit unsigned integer)
     11          at index k within string.
     12       [...]
     13       c. Else if char ≥ 256, then
     14          i. Let S be a String containing six code units "%uwxyz" where wxyz
     15             are the code units of the four uppercase hexadecimal digits
     16             encoding the value of char.
     17       [...]
     18 ---*/
     19 
     20 assert.sameValue(
     21  escape('\u0100\u0101\u0102'), '%u0100%u0101%u0102', '\\u0100\\u0101\\u0102'
     22 );
     23 
     24 assert.sameValue(
     25  escape('\ufffd\ufffe\uffff'), '%uFFFD%uFFFE%uFFFF', '\\ufffd\\ufffd\\ufffd'
     26 );
     27 
     28 assert.sameValue(
     29  escape('\ud834\udf06'), '%uD834%uDF06', '\\ud834\\udf06 (surrogate pairs)'
     30 );
     31 
     32 reportCompare(0, 0);