Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 1 | // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 5 | // test262/data/test/language/literals/regexp/u-dec-esc |
| 6 | assertThrows("/\\1/u", SyntaxError); |
| 7 | // test262/language/literals/regexp/u-invalid-char-range-a |
| 8 | assertThrows("/[\\w-a]/u", SyntaxError); |
| 9 | // test262/language/literals/regexp/u-invalid-char-range-b |
| 10 | assertThrows("/[a-\\w]/u", SyntaxError); |
| 11 | // test262/language/literals/regexp/u-invalid-char-esc |
| 12 | assertThrows("/\\c/u", SyntaxError); |
| 13 | assertThrows("/\\c0/u", SyntaxError); |
| 14 | // test262/built-ins/RegExp/unicode_restricted_quantifiable_assertion |
| 15 | assertThrows("/(?=.)*/u", SyntaxError); |
| 16 | // test262/built-ins/RegExp/unicode_restricted_octal_escape |
| 17 | assertThrows("/[\\1]/u", SyntaxError); |
| 18 | assertThrows("/\\00/u", SyntaxError); |
| 19 | assertThrows("/\\09/u", SyntaxError); |
| 20 | // test262/built-ins/RegExp/unicode_restricted_identity_escape_alpha |
| 21 | assertThrows("/[\\c]/u", SyntaxError); |
| 22 | // test262/built-ins/RegExp/unicode_restricted_identity_escape_c |
| 23 | assertThrows("/[\\c0]/u", SyntaxError); |
| 24 | // test262/built-ins/RegExp/unicode_restricted_incomple_quantifier |
| 25 | assertThrows("/a{/u", SyntaxError); |
| 26 | assertThrows("/a{1,/u", SyntaxError); |
| 27 | assertThrows("/{/u", SyntaxError); |
| 28 | assertThrows("/}/u", SyntaxError); |
| 29 | // test262/data/test/built-ins/RegExp/unicode_restricted_brackets |
| 30 | assertThrows("/]/u", SyntaxError); |
| 31 | // test262/built-ins/RegExp/unicode_identity_escape |
| 32 | /\//u; |
| 33 | |
| 34 | // escaped \0 is allowed inside a character class. |
| 35 | assertEquals(["\0"], /[\0]/u.exec("\0")); |
| 36 | // unless it is followed by another digit. |
| 37 | assertThrows("/[\\00]/u", SyntaxError); |
| 38 | assertThrows("/[\\01]/u", SyntaxError); |
| 39 | assertThrows("/[\\09]/u", SyntaxError); |
| 40 | assertEquals(["\u{0}1\u{0}a\u{0}"], /[1\0a]+/u.exec("b\u{0}1\u{0}a\u{0}2")); |
| 41 | // escaped \- is allowed inside a character class. |
| 42 | assertEquals(["-"], /[a\-z]/u.exec("12-34")); |