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 c12df27828378894ec802450a9db08eab353e3d4..27bf125746ce83d6166eb858985e237a23cf96e3 100644 --- a/test/built-ins/RegExp/named-groups/unicode-property-names.js +++ b/test/built-ins/RegExp/named-groups/unicode-property-names.js @@ -23,6 +23,8 @@ assert(/(?<a\uD801\uDCA4>.)/u.test("a"), "\\u Lead \\u Trail"); 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(RegExp("(?<\u{0041}>.)", "u").test("a"), "Non-surrogate"); +assert(RegExp("(?<a\u{104A4}>.)", "u").test("a"), "Surrogate,ID_Continue"); 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"); diff --git a/test/language/literals/regexp/named-groups/invalid-dangling-groupname-5.js b/test/language/literals/regexp/named-groups/invalid-dangling-groupname-5.js new file mode 100644 index 0000000000000000000000000000000000000000..582bf29d8a4d17492c77eec19ea2d43fd89459a0 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-dangling-groupname-5.js @@ -0,0 +1,20 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Group reference must have corresponding group. +info: | + It is a Syntax Error if the enclosing Pattern does not contain a + GroupSpecifier with an enclosed RegExpIdentifierName whose StringValue + equals the StringValue of the RegExpIdentifierName of this production's + GroupName. +esid: sec-patterns-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/\k<a>(?<b>x)/; diff --git a/test/language/literals/regexp/named-groups/invalid-lone-surrogate-groupname.js b/test/language/literals/regexp/named-groups/invalid-lone-surrogate-groupname.js new file mode 100644 index 0000000000000000000000000000000000000000..7be757996b7b3e175999adf79c46560b4d50e117 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-lone-surrogate-groupname.js @@ -0,0 +1,13 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Lone surrogates in RegExp group names +esid: prod-GroupSpecifier +features: [regexp-named-groups] +---*/ + +assert.throws(SyntaxError, () => eval("/(?<a\uD801>.)/"), "Lead"); +assert.throws(SyntaxError, () => eval("/(?<a\uDCA4>.)/"), "Trail"); +assert.throws(SyntaxError, () => eval("/(?<a\uD801>.)/u"), "Lead with u flag"); +assert.throws(SyntaxError, () => eval("/(?<a\uDCA4>.)/u"), "Trail with u flag"); 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 deleted file mode 100644 index 38f70fc6dedfd08f1913c1395e046fe7b28e30cd..0000000000000000000000000000000000000000 --- a/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-3.js +++ /dev/null @@ -1,15 +0,0 @@ -// 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-2.js b/test/language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier-2.js similarity index 77% rename from test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-2.js rename to test/language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier-2.js index e840db055376e9310144e5b2aaf780976e2ce723..7d58dc86b01c962b116e100c3e6b4eb27eb468e9 100644 --- a/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-2.js +++ b/test/language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier-2.js @@ -2,7 +2,7 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -description: GroupSpecifier must be identifier-like. +description: \u{} escapes in GroupSpecifier allowed only in Unicode mode esid: prod-GroupSpecifier negative: phase: parse @@ -12,4 +12,4 @@ features: [regexp-named-groups] throw "Test262: This statement should not be evaluated."; -/(?<a\uD801>.)/; +/(?<\u{03C0}>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 index 6dfd5e57552119361290eaf5dea5596f77ab9ee1..53f7b96bf68335e00d1e8fd0220c367662784dfc 100644 --- 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 @@ -12,4 +12,4 @@ features: [regexp-named-groups] throw "Test262: This statement should not be evaluated."; -/(?<\u{0041}>a)/; +/(?<\u{0041}>.)/;