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 9c02d0b5170be6aaa4aeaf060e11d09757e49988..4f062f7fb1b1f04bd86dad3c0cadbf524df02d8a 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("/(?<a\\uD801\uDCA4>.)/")); -assert.throws(SyntaxError, () => eval("/(?<a\\uD801>.)/")); -assert.throws(SyntaxError, () => eval("/(?<a\\uDCA4>.)/")); assert(/(?<\u0041>.)/.test("a")); -assert.throws(SyntaxError, () => eval("/(?<a\\u{104A4}>.)/")); -assert.throws(SyntaxError, () => eval("/(?<a\\u{10FFFF}>.)/")); -assert.throws(SyntaxError, () => eval("/(?<a\uD801>.)/"), "Lea"); -assert.throws(SyntaxError, () => eval("/(?<a\uDCA4>.)/"), "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("/(?<a\\uD801>.)/"), "Lead"); -assert.throws(SyntaxError, () => eval("/(?<a\\uDCA4>.)/"), "Trail"); -assert.throws(SyntaxError, () => eval("/(?<\\u{0041}>.)/"), "Non-surrogate"); -assert.throws(SyntaxError, () => eval("/(?<a\\u{104A4}>.)/"), "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("/(?<a\\>.)/"), "'\' 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 0000000000000000000000000000000000000000..e840db055376e9310144e5b2aaf780976e2ce723 --- /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."; + +/(?<a\uD801>.)/; 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 0000000000000000000000000000000000000000..38f70fc6dedfd08f1913c1395e046fe7b28e30cd --- /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."; + +/(?<a\uDCA4>.)/; 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 0000000000000000000000000000000000000000..027cac11ecf05044d23b580367ec38e122a156c3 --- /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."; + +/(?<a\>.)/; 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 0000000000000000000000000000000000000000..4e2096a35eba188f09a2bb2a84bdee6042b7e915 --- /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 0000000000000000000000000000000000000000..64637b6a1c12add4f11d93b3e78c24f26e881530 --- /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 0000000000000000000000000000000000000000..a4644b015bb5e0c59da98796a67a523f116e3657 --- /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."; + +/(?<a\uD801\uDCA4>.)/; 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 0000000000000000000000000000000000000000..e840db055376e9310144e5b2aaf780976e2ce723 --- /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."; + +/(?<a\uD801>.)/; 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 0000000000000000000000000000000000000000..38f70fc6dedfd08f1913c1395e046fe7b28e30cd --- /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."; + +/(?<a\uDCA4>.)/; 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 0000000000000000000000000000000000000000..f5cca3d30984afac7852ee9c0ce4a6bb7c6fd22b --- /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."; + +/(?<a\u{104A4}>.)/; 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 0000000000000000000000000000000000000000..59b7ded3467123d2c1530acd55ba155fd13c73f7 --- /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."; + +/(?<a\u{10FFFF}>.)/; 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 0000000000000000000000000000000000000000..22f8452ce7cf0502e81ab732ff16bdd7203d89dd --- /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 0000000000000000000000000000000000000000..cdaff4016ea94459e0da1e2d003d996308a587b0 --- /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 0000000000000000000000000000000000000000..6dfd5e57552119361290eaf5dea5596f77ab9ee1 --- /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)/;