diff --git a/test/built-ins/RegExp/named-groups/non-unicode-property-names.js b/test/built-ins/RegExp/named-groups/non-unicode-property-names.js index 9c02d0b517..4f062f7fb1 100644 --- a/test/built-ins/RegExp/named-groups/non-unicode-property-names.js +++ b/test/built-ins/RegExp/named-groups/non-unicode-property-names.js @@ -5,40 +5,19 @@ description: Exotic named group names in non-Unicode RegExps esid: prod-GroupSpecifier features: [regexp-named-groups] -includes: [compareArray.js] ---*/ assert.sameValue("a", /(?<π>a)/.exec("bab").groups.π); -assert.throws(SyntaxError, () => eval('/(?<\\u{03C0}>a)/'), "\\u{} escapes allowed only in Unicode mode"); assert.sameValue("a", /(?<π>a)/.exec("bab").groups.\u03C0); assert.sameValue("a", /(?<$>a)/.exec("bab").groups.$); assert.sameValue("a", /(?<_>a)/.exec("bab").groups._); -assert.throws(SyntaxError, () => eval('/(?<$𐒤>a)/'), "Individual surrogates not in ID_Continue"); assert.sameValue("a", /(?<_\u200C>a)/.exec("bab").groups._\u200C); assert.sameValue("a", /(?<_\u200D>a)/.exec("bab").groups._\u200D); assert.sameValue("a", /(?<ಠ_ಠ>a)/.exec("bab").groups.ಠ_ಠ); -assert.throws(SyntaxError, () => eval('/(?<❤>a)/')); -assert.throws(SyntaxError, () => eval('/(?<𐒤>a)/'), "Individual surrogate not in ID_Start."); // Unicode escapes in capture names. -assert.throws(SyntaxError, () => eval("/(?.)/")); -assert.throws(SyntaxError, () => eval("/(?.)/")); -assert.throws(SyntaxError, () => eval("/(?.)/")); assert(/(?<\u0041>.)/.test("a")); -assert.throws(SyntaxError, () => eval("/(?.)/")); -assert.throws(SyntaxError, () => eval("/(?.)/")); -assert.throws(SyntaxError, () => eval("/(?.)/"), "Lea"); -assert.throws(SyntaxError, () => eval("/(?.)/"), "Trai"); assert(RegExp("(?<\u{0041}>.)").test("a"), "Non-surrogate"); -// Bracketed escapes are not allowed; // 4-char escapes must be the proper ID_Start/ID_Continue -assert.throws(SyntaxError, () => eval("/(?.)/"), "Lead"); -assert.throws(SyntaxError, () => eval("/(?.)/"), "Trail"); -assert.throws(SyntaxError, () => eval("/(?<\\u{0041}>.)/"), "Non-surrogate"); -assert.throws(SyntaxError, () => eval("/(?.)/"), "Surrogate, ID_Continue"); assert(RegExp("(?<\\u0041>.)").test("a"), "Non-surrogate"); - -// Backslash is not allowed as ID_Start and ID_Continue -assert.throws(SyntaxError, () => eval("/(?<\\>.)/"), "'\' misclassified as ID_Start"); -assert.throws(SyntaxError, () => eval("/(?.)/"), "'\' misclassified as ID_Continue"); diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-2.js b/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-2.js new file mode 100644 index 0000000000..e840db0553 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-2.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."; + +/(?.)/; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-3.js b/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-3.js new file mode 100644 index 0000000000..38f70fc6de --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-3.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."; + +/(?.)/; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4.js b/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4.js new file mode 100644 index 0000000000..027cac11ec --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4.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."; + +/(?.)/; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier.js b/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier.js new file mode 100644 index 0000000000..4e2096a35e --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier.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)/; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2.js new file mode 100644 index 0000000000..64637b6a1c --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2.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)/; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3.js new file mode 100644 index 0000000000..a4644b015b --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3.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."; + +/(?.)/; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4.js new file mode 100644 index 0000000000..e840db0553 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4.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."; + +/(?.)/; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5.js new file mode 100644 index 0000000000..38f70fc6de --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5.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."; + +/(?.)/; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6.js new file mode 100644 index 0000000000..f5cca3d309 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6.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."; + +/(?.)/; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7.js new file mode 100644 index 0000000000..59b7ded346 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7.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."; + +/(?.)/; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8.js new file mode 100644 index 0000000000..22f8452ce7 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8.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."; + +/(?<\>.)/; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier.js new file mode 100644 index 0000000000..cdaff4016e --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier.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)/; diff --git a/test/language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier.js b/test/language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier.js new file mode 100644 index 0000000000..6dfd5e5755 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier.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: \u{} escapes in GroupSpecifier allowed only in Unicode mode +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<\u{0041}>a)/;