add empty references tests

This commit is contained in:
Aleksey Shvayka 2017-06-26 18:35:16 +03:00
parent c38f1d12b0
commit cb22dad417
2 changed files with 3 additions and 0 deletions

View File

@ -23,6 +23,7 @@ assert(/\k<a/.test("k<a"));
assert(/\k/.test("k"));
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>/"));

View File

@ -16,9 +16,11 @@ 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");