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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 498 } |
499 })(); | 499 })(); |
500 | 500 |
501 | 501 |
502 (function testValidNumericEscapes() { | 502 (function testValidNumericEscapes() { |
503 assertEquals("8", `\8`); | 503 assertEquals("8", `\8`); |
504 assertEquals("9", `\9`); | 504 assertEquals("9", `\9`); |
505 assertEquals("\u00008", `\08`); | 505 assertEquals("\u00008", `\08`); |
506 assertEquals("\u00009", `\09`); | 506 assertEquals("\u00009", `\09`); |
507 })(); | 507 })(); |
| 508 |
| 509 |
| 510 (function testLegacyOctalEscapesInExpressions() { |
| 511 // Allowed in sloppy expression |
| 512 assertEquals("\x07", `${"\07"}`); |
| 513 |
| 514 // Disallowed in template tail |
| 515 assertThrows("`${\"\\07\"}\\07`", SyntaxError); |
| 516 |
| 517 // Disallowed in strict expression |
| 518 assertThrows("`${(function() { \"use strict\"; return \"\\07\"; })()}`", |
| 519 SyntaxError); |
| 520 })(); |
OLD | NEW |