tor-browser

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

tv-character-escape-sequence.js (3149B)


      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 character escape sequences
      6 info: |
      7    The TV of TemplateCharacter :: \ EscapeSequence is the SV of
      8    EscapeSequence.
      9    The TRV of TemplateCharacter :: \ EscapeSequence is the sequence consisting
     10    of the code unit value 0x005C followed by the code units of TRV of
     11    EscapeSequence.
     12    The TRV of CharacterEscapeSequence :: SingleEscapeCharacter is the TRV of
     13    the SingleEscapeCharacter.
     14    The TRV of CharacterEscapeSequence :: NonEscapeCharacter is the SV of the
     15    NonEscapeCharacter.
     16 ---*/
     17 var calls;
     18 
     19 calls = 0;
     20 (function(s) {
     21  calls++;
     22  assert.sameValue(s[0], "'", "TV of NonEscapeCharacter");
     23  assert.sameValue(s.raw[0], "\u005C\u0027", "TRV of NonEscapeCharacter");
     24 })`\'`;
     25 assert.sameValue(calls, 1);
     26 
     27 calls = 0;
     28 (function(s) {
     29  calls++;
     30  assert.sameValue(s[0], "\"", "TV of SingleEscapeCharacter (double quote)");
     31  assert.sameValue(
     32    s.raw[0], "\u005C\u0022", "TRV of SingleEscapeCharacter (double quote)"
     33  );
     34 })`\"`;
     35 assert.sameValue(calls, 1);
     36 
     37 calls = 0;
     38 (function(s) {
     39  calls++;
     40  assert.sameValue(s[0], "\\", "TV of SingleEscapeCharacter (backslash)");
     41  assert.sameValue(
     42    s.raw[0], "\u005C\u005C", "TRV of SingleEscapeCharacter (backslash)"
     43  );
     44 })`\\`;
     45 assert.sameValue(calls, 1);
     46 
     47 calls = 0;
     48 (function(s) {
     49  calls++;
     50  assert.sameValue(s[0], "\b", "TV of SingleEscapeCharacter (backspace)");
     51  assert.sameValue(
     52    s.raw[0], "\u005Cb", "TRV of SingleEscapeCharacter (backspace)"
     53  );
     54 })`\b`;
     55 assert.sameValue(calls, 1);
     56 
     57 calls = 0;
     58 (function(s) {
     59  calls++;
     60  assert.sameValue(s[0], "\f", "TV of SingleEscapeCharacter (form feed)");
     61  assert.sameValue(
     62    s.raw[0], "\u005Cf", "TRV of SingleEscapeCharacter (form feed)"
     63  );
     64 })`\f`;
     65 assert.sameValue(calls, 1);
     66 
     67 calls = 0;
     68 (function(s) {
     69  calls++;
     70  assert.sameValue(s[0], "\n", "TV of SingleEscapeCharacter (new line)");
     71  assert.sameValue(
     72    s.raw[0], "\u005Cn", "TRV of SingleEscapeCharacter (new line)"
     73  );
     74 })`\n`;
     75 assert.sameValue(calls, 1);
     76 
     77 calls = 0;
     78 (function(s) {
     79  calls++;
     80  assert.sameValue(
     81    s[0], "\r", "TV of SingleEscapeCharacter (carriage return)"
     82  );
     83  assert.sameValue(
     84    s.raw[0], "\u005Cr", "TRV of SingleEscapeCharacter (carriage return)"
     85  );
     86 })`\r`;
     87 assert.sameValue(calls, 1);
     88 
     89 calls = 0;
     90 (function(s) {
     91  calls++;
     92  assert.sameValue(s[0], "	", "TV of SingleEscapeCharacter (tab)");
     93  assert.sameValue(s.raw[0], "\u005Ct", "TRV of SingleEscapeCharacter (tab)");
     94 })`\t`;
     95 assert.sameValue(calls, 1);
     96 
     97 calls = 0;
     98 (function(s) {
     99  calls++;
    100  assert.sameValue(
    101    s[0], "\v", "TV of SingleEscapeCharacter (line tabulation)"
    102  );
    103  assert.sameValue(
    104    s.raw[0], "\u005Cv", "TRV of SingleEscapeCharacter (line tabulation)"
    105  );
    106 })`\v`;
    107 assert.sameValue(calls, 1);
    108 
    109 calls = 0;
    110 (function(s) {
    111  calls++;
    112  assert.sameValue(s[0], "`", "TV of SingleEscapeCharacter (backtick)");
    113  assert.sameValue(
    114    s.raw[0], "\u005C`", "TRV of SingleEscapeCharacter (backtick)"
    115  );
    116 })`\``;
    117 assert.sameValue(calls, 1);
    118 
    119 reportCompare(0, 0);