Skip to content
Snippets Groups Projects
Commit de339e98 authored by Kevin Gibbons's avatar Kevin Gibbons
Browse files

split non-unicode-malformed.js

parent 69c1efd3
No related branches found
No related tags found
No related merge requests found
Showing
with 311 additions and 35 deletions
// 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>.)/"));
// 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"));
// 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>/;
// 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>/;
// 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)/;
// 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)/;
// 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>/;
// 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)/;
// 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)/;
// 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)/;
// 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/;
// 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<>/;
// 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)/;
// 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>.)/;
// 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>.)/;
// 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/;
// 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)/;
// 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)/;
// 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)/;
// 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)/;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment