OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-templates --harmony-unicode | 5 // Flags: --harmony-templates --harmony-unicode |
6 | 6 |
7 var num = 5; | 7 var num = 5; |
8 var str = "str"; | 8 var str = "str"; |
9 function fn() { return "result"; } | 9 function fn() { return "result"; } |
10 var obj = { | 10 var obj = { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 (function(s) { calls++; assertEquals("\u005C\u005C", s.raw[0]); })`\\`; | 243 (function(s) { calls++; assertEquals("\u005C\u005C", s.raw[0]); })`\\`; |
244 (function(s) { calls++; assertEquals("\u005Cb", s.raw[0]); })`\b`; | 244 (function(s) { calls++; assertEquals("\u005Cb", s.raw[0]); })`\b`; |
245 (function(s) { calls++; assertEquals("\u005Cf", s.raw[0]); })`\f`; | 245 (function(s) { calls++; assertEquals("\u005Cf", s.raw[0]); })`\f`; |
246 (function(s) { calls++; assertEquals("\u005Cn", s.raw[0]); })`\n`; | 246 (function(s) { calls++; assertEquals("\u005Cn", s.raw[0]); })`\n`; |
247 (function(s) { calls++; assertEquals("\u005Cr", s.raw[0]); })`\r`; | 247 (function(s) { calls++; assertEquals("\u005Cr", s.raw[0]); })`\r`; |
248 (function(s) { calls++; assertEquals("\u005Ct", s.raw[0]); })`\t`; | 248 (function(s) { calls++; assertEquals("\u005Ct", s.raw[0]); })`\t`; |
249 (function(s) { calls++; assertEquals("\u005Cv", s.raw[0]); })`\v`; | 249 (function(s) { calls++; assertEquals("\u005Cv", s.raw[0]); })`\v`; |
250 (function(s) { calls++; assertEquals("\u005C`", s.raw[0]); })`\``; | 250 (function(s) { calls++; assertEquals("\u005C`", s.raw[0]); })`\``; |
251 assertEquals(10, calls); | 251 assertEquals(10, calls); |
252 | 252 |
253 // The TRV of CharacterEscapeSequence :: NonEscapeCharacter is the CV of the | |
254 // NonEscapeCharacter. | |
255 calls = 0; | |
256 (function(s) { calls++; assertEquals("\u005Cx", s.raw[0]); })`\x`; | |
caitp (gmail)
2014/12/17 19:35:56
Maybe just replace `\x` with `\z` or something?
arv (Not doing code reviews)
2014/12/17 20:22:07
Done.
| |
257 assertEquals(1, calls); | |
258 | |
259 // The TRV of LineTerminatorSequence :: <LF> is the code unit value 0x000A. | 253 // The TRV of LineTerminatorSequence :: <LF> is the code unit value 0x000A. |
260 // The TRV of LineTerminatorSequence :: <CR> is the code unit value 0x000A. | 254 // The TRV of LineTerminatorSequence :: <CR> is the code unit value 0x000A. |
261 // The TRV of LineTerminatorSequence :: <CR><LF> is the sequence consisting of | 255 // The TRV of LineTerminatorSequence :: <CR><LF> is the sequence consisting of |
262 // the code unit value 0x000A. | 256 // the code unit value 0x000A. |
263 calls = 0; | 257 calls = 0; |
264 function testRawLineNormalization(cs) { | 258 function testRawLineNormalization(cs) { |
265 calls++; | 259 calls++; |
266 assertEquals(cs.raw[0], "\n\n\n"); | 260 assertEquals(cs.raw[0], "\n\n\n"); |
267 assertEquals(cs.raw[1], "\n\n\n"); | 261 assertEquals(cs.raw[1], "\n\n\n"); |
268 } | 262 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
464 | 458 |
465 { | 459 { |
466 // block | 460 // block |
467 } | 461 } |
468 `ghi`; | 462 `ghi`; |
469 | 463 |
470 { | 464 { |
471 // block | 465 // block |
472 }`jkl`; | 466 }`jkl`; |
473 })(); | 467 })(); |
468 | |
469 | |
470 (function testLegacyOctal() { | |
471 assertEquals('\u0000', `\0`); | |
472 assertEquals('123', `\123`); | |
473 assertThrows("`\\01`", SyntaxError); | |
474 assertThrows("`\\08`", SyntaxError); | |
475 assertThrows("`\\01`", SyntaxError); | |
caitp (gmail)
2014/12/17 19:35:56
This looks like a duplicate
\00, \01, \02, \03, \
arv (Not doing code reviews)
2014/12/17 20:22:07
Adding more tests
| |
476 | |
477 assertEquals('\\0', String.raw`\0`); | |
478 assertEquals('\\123', String.raw`\123`); | |
caitp (gmail)
2014/12/17 19:35:56
My reading of the spec is that this should be a Sy
arv (Not doing code reviews)
2014/12/17 20:22:07
You are right. Fixing.
| |
479 })(); | |
480 | |
481 | |
482 (function testSyntaxErrorsNonEscapeCharacter() { | |
483 assertThrows("`\\x`", SyntaxError); | |
484 assertThrows("`\\u`", SyntaxError); | |
485 })(); | |
OLD | NEW |