From de339e98d6ecffb391e40db63e437bd913f79b4c Mon Sep 17 00:00:00 2001
From: Kevin Gibbons <kevin@shapesecurity.com>
Date: Mon, 5 Nov 2018 14:58:03 -0800
Subject: [PATCH] split non-unicode-malformed.js

---
 .../named-groups/non-unicode-malformed.js     | 35 -------------------
 .../regexp/named-groups/forward-reference.js  | 10 ++++++
 .../invalid-dangling-groupname-2.js           | 20 +++++++++++
 .../invalid-dangling-groupname-3.js           | 20 +++++++++++
 .../invalid-dangling-groupname-4.js           | 20 +++++++++++
 .../invalid-dangling-groupname-5.js           | 20 +++++++++++
 .../invalid-dangling-groupname.js             | 20 +++++++++++
 .../invalid-duplicate-groupspecifier-2.js     | 18 ++++++++++
 .../invalid-duplicate-groupspecifier.js       | 18 ++++++++++
 .../invalid-empty-groupspecifier.js           | 15 ++++++++
 .../invalid-incomplete-groupname-2.js         | 15 ++++++++
 .../invalid-incomplete-groupname-3.js         | 15 ++++++++
 .../invalid-incomplete-groupname-4.js         | 15 ++++++++
 .../invalid-incomplete-groupname-5.js         | 15 ++++++++
 .../invalid-incomplete-groupname-6.js         | 15 ++++++++
 .../invalid-incomplete-groupname.js           | 15 ++++++++
 .../invalid-incomplete-groupspecifier.js      | 15 ++++++++
 .../invalid-numeric-groupspecifier.js         | 15 ++++++++
 .../invalid-punctuator-in-groupspecifier-2.js | 15 ++++++++
 .../invalid-punctuator-in-groupspecifier.js   | 15 ++++++++
 20 files changed, 311 insertions(+), 35 deletions(-)
 delete mode 100644 test/built-ins/RegExp/named-groups/non-unicode-malformed.js
 create mode 100644 test/language/literals/regexp/named-groups/forward-reference.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-dangling-groupname-2.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-dangling-groupname-3.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-dangling-groupname-4.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-dangling-groupname-5.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-dangling-groupname.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-empty-groupspecifier.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-incomplete-groupname-2.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-incomplete-groupname-3.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-incomplete-groupname-4.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-incomplete-groupname-5.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-incomplete-groupname-6.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-incomplete-groupname.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-incomplete-groupspecifier.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-numeric-groupspecifier.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-punctuator-in-groupspecifier-2.js
 create mode 100644 test/language/literals/regexp/named-groups/invalid-punctuator-in-groupspecifier.js

diff --git a/test/built-ins/RegExp/named-groups/non-unicode-malformed.js b/test/built-ins/RegExp/named-groups/non-unicode-malformed.js
deleted file mode 100644
index 37d47a692a..0000000000
--- a/test/built-ins/RegExp/named-groups/non-unicode-malformed.js
+++ /dev/null
@@ -1,35 +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: >
-  Named groups in Unicode RegExps have some syntax errors and some
-  compatibility escape fallback behavior.
-esid: prod-GroupSpecifier
-features: [regexp-named-groups]
-includes: [compareArray.js]
----*/
-
-assert.throws(SyntaxError, () => eval("/(?<>a)/"));
-assert.throws(SyntaxError, () => eval("/(?<aa)/"));
-assert.throws(SyntaxError, () => eval("/(?<42a>a)/"));
-assert.throws(SyntaxError, () => eval("/(?<:a>a)/"));
-assert.throws(SyntaxError, () => eval("/(?<a:>a)/"));
-assert.throws(SyntaxError, () => eval("/(?<a>a)(?<a>a)/"));
-assert.throws(SyntaxError, () => eval("/(?<a>a)(?<b>b)(?<a>a)/"));
-
-assert.throws(SyntaxError, () => eval("/(?<a>.)\\k/"));
-assert.throws(SyntaxError, () => eval("/(?<a>.)\\k<a/"));
-assert.throws(SyntaxError, () => eval("/(?<a>.)\\k<>/"));
-assert.throws(SyntaxError, () => eval("/(?<a>.)\\k<b>/"));
-assert.throws(SyntaxError, () => eval("/(?<a>a)\\k<ab>/"));
-assert.throws(SyntaxError, () => eval("/(?<ab>a)\\k<a>/"));
-assert.throws(SyntaxError, () => eval("/\\k<a>(?<ab>a)/"));
-assert.throws(SyntaxError, () => eval("/\\k<a(?<a>a)/"));
-
-// A couple of corner cases around '\k' as named back-references vs. identity
-// escapes.
-assert(/\k<a>(?<a>x)/.test("x"));
-assert.throws(SyntaxError, () => eval("/\\k<a>(?<b>x)/"));
-assert.throws(SyntaxError, () => eval("/\\k<a(?<a>.)/"));
-assert.throws(SyntaxError, () => eval("/\\k(?<a>.)/"));
diff --git a/test/language/literals/regexp/named-groups/forward-reference.js b/test/language/literals/regexp/named-groups/forward-reference.js
new file mode 100644
index 0000000000..a6dd3c37f2
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/forward-reference.js
@@ -0,0 +1,10 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Named groups can be forward references.
+esid: sec-atomescape
+features: [regexp-named-groups]
+---*/
+
+assert(/\k<a>(?<a>x)/.test("x"));
diff --git a/test/language/literals/regexp/named-groups/invalid-dangling-groupname-2.js b/test/language/literals/regexp/named-groups/invalid-dangling-groupname-2.js
new file mode 100644
index 0000000000..ec03c951d7
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-dangling-groupname-2.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.";
+
+/(?<a>a)\k<ab>/;
diff --git a/test/language/literals/regexp/named-groups/invalid-dangling-groupname-3.js b/test/language/literals/regexp/named-groups/invalid-dangling-groupname-3.js
new file mode 100644
index 0000000000..48489ff589
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-dangling-groupname-3.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.";
+
+/(?<ab>a)\k<a>/;
diff --git a/test/language/literals/regexp/named-groups/invalid-dangling-groupname-4.js b/test/language/literals/regexp/named-groups/invalid-dangling-groupname-4.js
new file mode 100644
index 0000000000..fac6cad35e
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-dangling-groupname-4.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>(?<ab>a)/;
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 0000000000..582bf29d8a
--- /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-dangling-groupname.js b/test/language/literals/regexp/named-groups/invalid-dangling-groupname.js
new file mode 100644
index 0000000000..b215f8c46b
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-dangling-groupname.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.";
+
+/(?<a>.)\k<b>/;
diff --git a/test/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js b/test/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js
new file mode 100644
index 0000000000..1ca18d9242
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js
@@ -0,0 +1,18 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: GroupSpecifiers must be unique.
+info: |
+  It is a Syntax Error if Pattern contains multiple GroupSpecifiers
+  whose enclosed RegExpIdentifierNames have the same StringValue.
+esid: sec-patterns-static-semantics-early-errors
+negative:
+  phase: parse
+  type: SyntaxError
+features: [regexp-named-groups]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+/(?<a>a)(?<b>b)(?<a>a)/;
diff --git a/test/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js b/test/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js
new file mode 100644
index 0000000000..1cbc8c2e27
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js
@@ -0,0 +1,18 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: GroupSpecifiers must be unique.
+info: |
+  It is a Syntax Error if Pattern contains multiple GroupSpecifiers
+  whose enclosed RegExpIdentifierNames have the same StringValue.
+esid: sec-patterns-static-semantics-early-errors
+negative:
+  phase: parse
+  type: SyntaxError
+features: [regexp-named-groups]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+/(?<a>a)(?<a>a)/;
diff --git a/test/language/literals/regexp/named-groups/invalid-empty-groupspecifier.js b/test/language/literals/regexp/named-groups/invalid-empty-groupspecifier.js
new file mode 100644
index 0000000000..1050d96060
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-empty-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-incomplete-groupname-2.js b/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-2.js
new file mode 100644
index 0000000000..a5532fea0d
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-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: GroupName is `< RegExpIdentifierName >`.
+esid: prod-GroupName
+negative:
+  phase: parse
+  type: SyntaxError
+features: [regexp-named-groups]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+/(?<a>.)\k<a/;
diff --git a/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-3.js b/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-3.js
new file mode 100644
index 0000000000..9fe83adaae
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-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: GroupName is `< RegExpIdentifierName >`.
+esid: prod-GroupName
+negative:
+  phase: parse
+  type: SyntaxError
+features: [regexp-named-groups]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+/(?<a>.)\k<>/;
diff --git a/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-4.js b/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-4.js
new file mode 100644
index 0000000000..0406bad509
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-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: GroupName is `< RegExpIdentifierName >`.
+esid: prod-GroupName
+negative:
+  phase: parse
+  type: SyntaxError
+features: [regexp-named-groups]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+/\k<a(?<a>a)/;
diff --git a/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-5.js b/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-5.js
new file mode 100644
index 0000000000..5f46988659
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-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: GroupName is `< RegExpIdentifierName >`.
+esid: prod-GroupName
+negative:
+  phase: parse
+  type: SyntaxError
+features: [regexp-named-groups]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+/\k<a(?<a>.)/;
diff --git a/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-6.js b/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-6.js
new file mode 100644
index 0000000000..88f9039386
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-incomplete-groupname-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: GroupName is `< RegExpIdentifierName >`.
+esid: prod-GroupName
+negative:
+  phase: parse
+  type: SyntaxError
+features: [regexp-named-groups]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+/\k(?<a>.)/;
diff --git a/test/language/literals/regexp/named-groups/invalid-incomplete-groupname.js b/test/language/literals/regexp/named-groups/invalid-incomplete-groupname.js
new file mode 100644
index 0000000000..f660e1fa8d
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-incomplete-groupname.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: GroupName is `< RegExpIdentifierName >`.
+esid: prod-GroupName
+negative:
+  phase: parse
+  type: SyntaxError
+features: [regexp-named-groups]
+---*/
+
+throw "Test262: This statement should not be evaluated.";
+
+/(?<a>.)\k/;
diff --git a/test/language/literals/regexp/named-groups/invalid-incomplete-groupspecifier.js b/test/language/literals/regexp/named-groups/invalid-incomplete-groupspecifier.js
new file mode 100644
index 0000000000..6ccac1ce1e
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-incomplete-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.";
+
+/(?<aa)/;
diff --git a/test/language/literals/regexp/named-groups/invalid-numeric-groupspecifier.js b/test/language/literals/regexp/named-groups/invalid-numeric-groupspecifier.js
new file mode 100644
index 0000000000..235e780734
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-numeric-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.";
+
+/(?<42a>a)/;
diff --git a/test/language/literals/regexp/named-groups/invalid-punctuator-in-groupspecifier-2.js b/test/language/literals/regexp/named-groups/invalid-punctuator-in-groupspecifier-2.js
new file mode 100644
index 0000000000..8fec9b8ff9
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-punctuator-in-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:>a)/;
diff --git a/test/language/literals/regexp/named-groups/invalid-punctuator-in-groupspecifier.js b/test/language/literals/regexp/named-groups/invalid-punctuator-in-groupspecifier.js
new file mode 100644
index 0000000000..3e646904a1
--- /dev/null
+++ b/test/language/literals/regexp/named-groups/invalid-punctuator-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: 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>a)/;
-- 
GitLab