split unicode-malformed.js

This commit is contained in:
Kevin Gibbons 2018-11-05 15:23:03 -08:00
parent 296f47a008
commit 9bc9116656
23 changed files with 297 additions and 30 deletions

View File

@ -1,29 +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: Various syntax errors for Unicode RegExps containing named groups
esid: prod-GroupSpecifier
features: [regexp-named-groups]
---*/
assert.throws(SyntaxError, () => eval("/(?<>a)/u"), "Empty name");
assert.throws(SyntaxError, () => eval("/(?<aa)/u"), "Unterminated name");
assert.throws(SyntaxError, () => eval("/(?<42a>a)/u"), "Name starting with digits");
assert.throws(SyntaxError, () => eval("/(?<:a>a)/u"), "Name starting with invalid char");
assert.throws(SyntaxError, () => eval("/(?<a:>a)/u"), "Name containing with invalid char");
assert.throws(SyntaxError, () => eval("/(?<a>a)(?<a>a)/u"), "Duplicate name");
assert.throws(SyntaxError, () => eval("/(?<a>a)(?<b>b)(?<a>a)/u"), "Duplicate name");
assert.throws(SyntaxError, () => eval("/\\k<a>/u"), "Invalid reference");
assert.throws(SyntaxError, () => eval("/\\k<a/u"), "Unterminated reference");
assert.throws(SyntaxError, () => eval("/\\k<>/u"), "Empty reference");
assert.throws(SyntaxError, () => eval("/\\k/u"), "Lone \k");
assert.throws(SyntaxError, () => eval("/(?<a>.)\\k/u"), "Lone \k");
assert.throws(SyntaxError, () => eval("/(?<a>.)\\k<a/u"), "Unterminated reference");
assert.throws(SyntaxError, () => eval("/(?<a>.)\\k<>/u"), "Empty reference");
assert.throws(SyntaxError, () => eval("/(?<a>.)\\k<b>/u"), "Invalid reference");
assert.throws(SyntaxError, () => eval("/(?<a>a)\\k<ab>/u"), "Invalid reference");
assert.throws(SyntaxError, () => eval("/(?<ab>a)\\k<a>/u"), "Invalid reference");
assert.throws(SyntaxError, () => eval("/\\k<a>(?<ab>a)/u"), "Invalid reference");
assert.throws(SyntaxError, () => eval("/(?<a>\\a)/u"), "Identity escape in capture");

View File

@ -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>/u;

View File

@ -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>/u;

View File

@ -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)/u;

View File

@ -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>/u;

View File

@ -17,4 +17,4 @@ features: [regexp-named-groups]
throw "Test262: This statement should not be evaluated.";
/\k<a>(?<b>x)/;
/\k<a>/u;

View File

@ -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)/u;

View File

@ -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)/u;

View File

@ -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;

View File

@ -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>\a)/u;

View File

@ -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/u;

View File

@ -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<>/u;

View File

@ -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/u;

View File

@ -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<>/u;

View File

@ -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/u;

View File

@ -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/u;

View File

@ -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)/u;

View File

@ -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)/u;

View File

@ -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)/u;

View File

@ -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)/u;