diff --git a/test/built-ins/RegExp/named-groups/unicode-property-names.js b/test/built-ins/RegExp/named-groups/unicode-property-names.js index 24e4a6ade9c9dace21ea165a0127464768c30b3e..c12df27828378894ec802450a9db08eab353e3d4 100644 --- a/test/built-ins/RegExp/named-groups/unicode-property-names.js +++ b/test/built-ins/RegExp/named-groups/unicode-property-names.js @@ -17,30 +17,12 @@ assert.sameValue("a", /(?<$ð’¤>a)/u.exec("bab").groups.$ð’¤); assert.sameValue("a", /(?<_\u200C>a)/u.exec("bab").groups._\u200C); assert.sameValue("a", /(?<_\u200D>a)/u.exec("bab").groups._\u200D); assert.sameValue("a", /(?<ಠ_ಠ>a)/u.exec("bab").groups.ಠ_ಠ); -assert.throws(SyntaxError, () => eval('/(?<â¤>a)/u')); -assert.throws(SyntaxError, () => eval('/(?<ð’¤>a)/u'), "ID_Continue but not ID_Start."); // Unicode escapes in capture names. assert(/(?<a\uD801\uDCA4>.)/u.test("a"), "\\u Lead \\u Trail"); -assert.throws(SyntaxError, () => eval("/(?<a\\uD801>.)/u"), "\\u Lea"); -assert.throws(SyntaxError, () => eval("/(?<a\\uDCA4>.)/u"), "\\u Trai"); assert(/(?<\u0041>.)/u.test("a"), "\\u NonSurrogate"); assert(/(?<\u{0041}>.)/u.test("a"), "\\u{ Non-surrogate }"); assert(/(?<a\u{104A4}>.)/u.test("a"), "\\u{ Surrogate, ID_Continue }"); -assert.throws(SyntaxError, () => eval("/(?<a\\u{110000}>.)/u"), "\\u{ Out-of-bounds "); -assert.throws(SyntaxError, () => eval("/(?<a\uD801>.)/u"), "Lea"); -assert.throws(SyntaxError, () => eval("/(?<a\uDCA4>.)/u"), "Trai"); -assert(RegExp("(?<\u{0041}>.)", "u").test("a"), "Non-surrogate"); -assert(RegExp("(?<a\u{104A4}>.)", "u").test("a"), "Surrogate,ID_Continue"); - -// Bracketed escapes are not allowed; -// 4-char escapes must be the proper ID_Start/ID_Continue -assert.throws(SyntaxError, () => eval("/(?<a\\uD801>.)/u"), "Lead"); -assert.throws(SyntaxError, () => eval("/(?<a\\uDCA4>.)/u"), "Trail"); assert((/(?<\u{0041}>.)/u).test("a"), "Non-surrogate"); assert(/(?<a\u{104A4}>.)/u.test("a"), "Surrogate, ID_Continue"); assert(RegExp("(?<\\u0041>.)", "u").test("a"), "Non-surrogate"); - -// Backslash is not allowed as ID_Start and ID_Continue -assert.throws(SyntaxError, () => eval("/(?<\\>.)/u"), "'\' misclassified as ID_Start"); -assert.throws(SyntaxError, () => eval("/(?<a\\>.)/u"), "'\' misclassified as ID_Continue"); diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js new file mode 100644 index 0000000000000000000000000000000000000000..45b1ca633395e7e593fa49755de4a34c230e7b7e --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<a\>.)/u; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js new file mode 100644 index 0000000000000000000000000000000000000000..fdc877557281f9a32e83ce0375221b12851dc1e8 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<ð’¤>a)/u; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js new file mode 100644 index 0000000000000000000000000000000000000000..af260334dbf103ab4826b1aa8a5b8a9d29bb683d --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<a\uD801>.)/u; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js new file mode 100644 index 0000000000000000000000000000000000000000..fb3d9c414b928a4b474b04325bce57e6f90d78e2 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<a\uDCA4>.)/u; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js new file mode 100644 index 0000000000000000000000000000000000000000..7796572c74aa050f84eb57c977a70dd2967e8aca --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<\>.)/u; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js new file mode 100644 index 0000000000000000000000000000000000000000..7fff1ae7905f1bebd0cc37d37f9dcca8a756e8af --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<a\u{110000}>.)/u; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js new file mode 100644 index 0000000000000000000000000000000000000000..ea4a41b5f83c877b18e26f5be02d44bf8fd6c31f --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<â¤>a)/u;