Skip to content
Snippets Groups Projects
Commit 804e0083 authored by André Bargull's avatar André Bargull Committed by Rick Waldron
Browse files

Split Annex-B parts of non-unicode-malformed.js into annexB folder

parent 765f273a
No related branches found
No related tags found
No related merge requests found
// 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, regexp-lookbehind]
includes: [compareArray.js]
---*/
assert(/\k<a>/.test("k<a>"));
assert(/\k<4>/.test("k<4>"));
assert(/\k<a/.test("k<a"));
assert(/\k/.test("k"));
assert(/(?<a>\a)/.test("a"));
assert(compareArray(["k<a>"], "xxxk<a>xxx".match(/\k<a>/)));
assert(compareArray(["k<a"], "xxxk<a>xxx".match(/\k<a/)));
// A couple of corner cases around '\k' as named back-references vs. identity
// escapes.
assert(/\k<a>(?<=>)a/.test("k<a>a"));
assert(/\k<a>(?<!a)a/.test("k<a>a"));
assert(/\k<a>(<a>x)/.test("k<a><a>x"));
...@@ -6,7 +6,7 @@ description: > ...@@ -6,7 +6,7 @@ description: >
Named groups in Unicode RegExps have some syntax errors and some Named groups in Unicode RegExps have some syntax errors and some
compatibility escape fallback behavior. compatibility escape fallback behavior.
esid: prod-GroupSpecifier esid: prod-GroupSpecifier
features: [regexp-named-groups, regexp-lookbehind] features: [regexp-named-groups]
includes: [compareArray.js] includes: [compareArray.js]
---*/ ---*/
...@@ -17,10 +17,7 @@ assert.throws(SyntaxError, () => eval("/(?<:a>a)/")); ...@@ -17,10 +17,7 @@ assert.throws(SyntaxError, () => eval("/(?<:a>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)(?<a>a)/"));
assert.throws(SyntaxError, () => eval("/(?<a>a)(?<b>b)(?<a>a)/")); assert.throws(SyntaxError, () => eval("/(?<a>a)(?<b>b)(?<a>a)/"));
assert(/\k<a>/.test("k<a>"));
assert(/\k<4>/.test("k<4>"));
assert(/\k<a/.test("k<a"));
assert(/\k/.test("k"));
assert.throws(SyntaxError, () => eval("/(?<a>.)\\k/")); assert.throws(SyntaxError, () => eval("/(?<a>.)\\k/"));
assert.throws(SyntaxError, () => eval("/(?<a>.)\\k<a/")); assert.throws(SyntaxError, () => eval("/(?<a>.)\\k<a/"));
assert.throws(SyntaxError, () => eval("/(?<a>.)\\k<>/")); assert.throws(SyntaxError, () => eval("/(?<a>.)\\k<>/"));
...@@ -29,16 +26,9 @@ assert.throws(SyntaxError, () => eval("/(?<a>a)\\k<ab>/")); ...@@ -29,16 +26,9 @@ assert.throws(SyntaxError, () => eval("/(?<a>a)\\k<ab>/"));
assert.throws(SyntaxError, () => eval("/(?<ab>a)\\k<a>/")); assert.throws(SyntaxError, () => eval("/(?<ab>a)\\k<a>/"));
assert.throws(SyntaxError, () => eval("/\\k<a>(?<ab>a)/")); assert.throws(SyntaxError, () => eval("/\\k<a>(?<ab>a)/"));
assert.throws(SyntaxError, () => eval("/\\k<a(?<a>a)/")); assert.throws(SyntaxError, () => eval("/\\k<a(?<a>a)/"));
assert(/(?<a>\a)/.test("a"));
assert(compareArray(["k<a>"], "xxxk<a>xxx".match(/\k<a>/)));
assert(compareArray(["k<a"], "xxxk<a>xxx".match(/\k<a/)));
// A couple of corner cases around '\k' as named back-references vs. identity // A couple of corner cases around '\k' as named back-references vs. identity
// escapes. // escapes.
assert(/\k<a>(?<=>)a/.test("k<a>a"));
assert(/\k<a>(?<!a)a/.test("k<a>a"));
assert(/\k<a>(<a>x)/.test("k<a><a>x"));
assert(/\k<a>(?<a>x)/.test("x")); assert(/\k<a>(?<a>x)/.test("x"));
assert.throws(SyntaxError, () => eval("/\\k<a>(?<b>x)/")); assert.throws(SyntaxError, () => eval("/\\k<a>(?<b>x)/"));
assert.throws(SyntaxError, () => eval("/\\k<a(?<a>.)/")); assert.throws(SyntaxError, () => eval("/\\k<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