tor-browser

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

tv-utf16-escape-sequence.js (1557B)


      1 // Copyright (C) 2014 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 es6id: 11.8.6.1
      5 description: Template values of UTF-16 escape sequences
      6 info: |
      7    The TV of TemplateCharacter :: \ EscapeSequence is the SV of
      8    EscapeSequence.
      9    The SV of UnicodeEscapeSequence :: u{ HexDigits } is the UTF16Encoding
     10    (10.1.1) of the MV of HexDigits.
     11    The TRV of UnicodeEscapeSequence :: u Hex4Digits is the sequence consisting
     12    of code unit value 0x0075 followed by TRV of Hex4Digits.
     13    The TRV of UnicodeEscapeSequence :: u{ HexDigits } is the sequence
     14    consisting of code unit value 0x0075 followed by code unit value 0x007B
     15    followed by TRV of HexDigits followed by code unit value 0x007D.
     16 ---*/
     17 
     18 var calls;
     19 
     20 calls = 0;
     21 (function(s) {
     22  calls++;
     23  assert.sameValue(s[0], 'b', 'u Hex4Digits template value');
     24  assert.sameValue(s.raw[0], '\\u0062', 'u Hex4Digits template raw value');
     25 })`\u0062`;
     26 assert.sameValue(calls, 1);
     27 
     28 calls = 0;
     29 (function(s) {
     30  calls++;
     31  assert.sameValue(s[0], 'b', 'u{ HexDigits } template value');
     32  assert.sameValue(
     33    s.raw[0], '\\u{62}', 'u{ Hex4Digits } template raw value'
     34  );
     35 })`\u{62}`;
     36 assert.sameValue(calls, 1);
     37 
     38 calls = 0;
     39 (function(s) {
     40  calls++;
     41  assert.sameValue(
     42    s[0], 'b', 'u{ HexDigits } template value (with leading zeros)'
     43  );
     44  assert.sameValue(
     45    s.raw[0],
     46    '\\u{000062}',
     47    'u{ HexDigits } template raw value (with leading zeros)'
     48  );
     49 })`\u{000062}`;
     50 assert.sameValue(calls, 1);
     51 
     52 reportCompare(0, 0);