v8/test/mjsunit/harmony/unicode-regexp-restricted-syntax.js
yangguo e918c4ec46 [regexp] restrict pattern syntax for unicode mode.
ES2015 Annex B.1.4 specifies a restricted pattern language for unicode
mode. This change reflects that, based on some test262 test cases.

R=littledan@chromium.org
BUG=v8:2952
LOG=N

Review URL: https://codereview.chromium.org/1645573002

Cr-Commit-Position: refs/heads/master@{#33584}
2016-01-28 14:24:37 +00:00

35 lines
1.3 KiB
JavaScript

// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-unicode-regexps
// test262/data/test/language/literals/regexp/u-dec-esc
assertThrows("/\\1/u");
// test262/language/literals/regexp/u-invalid-char-range-a
assertThrows("/[\\w-a]/u");
// test262/language/literals/regexp/u-invalid-char-range-b
assertThrows("/[a-\\w]/u");
// test262/language/literals/regexp/u-invalid-char-esc
assertThrows("/\\c/u");
assertThrows("/\\c0/u");
// test262/built-ins/RegExp/unicode_restricted_quantifiable_assertion
assertThrows("/(?=.)*/u");
// test262/built-ins/RegExp/unicode_restricted_octal_escape
assertThrows("/[\\1]/u");
assertThrows("/\\00/u");
assertThrows("/\\09/u");
// test262/built-ins/RegExp/unicode_restricted_identity_escape_alpha
assertThrows("/[\\c]/u");
// test262/built-ins/RegExp/unicode_restricted_identity_escape_c
assertThrows("/[\\c0]/u");
// test262/built-ins/RegExp/unicode_restricted_incomple_quantifier
assertThrows("/a{/u");
assertThrows("/a{1,/u");
assertThrows("/{/u");
assertThrows("/}/u");
// test262/data/test/built-ins/RegExp/unicode_restricted_brackets
assertThrows("/]/u");
// test262/built-ins/RegExp/unicode_identity_escape
/\//u;