mirror of https://github.com/tc39/test262.git
Add assertion messages
This commit is contained in:
parent
a57d2736e3
commit
99e32c6912
|
@ -18,36 +18,36 @@ es6id: 21.1.2
|
|||
// ^ $ \ . * + ? ( ) [ ] { } |
|
||||
|
||||
// IdentityEscape in AtomEscape
|
||||
assert(/\^/u.test("^"));
|
||||
assert(/\$/u.test("$"));
|
||||
assert(/\\/u.test("\\"));
|
||||
assert(/\./u.test("."));
|
||||
assert(/\*/u.test("*"));
|
||||
assert(/\+/u.test("+"));
|
||||
assert(/\?/u.test("?"));
|
||||
assert(/\(/u.test("("));
|
||||
assert(/\)/u.test(")"));
|
||||
assert(/\[/u.test("["));
|
||||
assert(/\]/u.test("]"));
|
||||
assert(/\{/u.test("{"));
|
||||
assert(/\}/u.test("}"));
|
||||
assert(/\|/u.test("|"));
|
||||
assert(/\//u.test("/"));
|
||||
assert(/\^/u.test("^"), "IdentityEscape in AtomEscape: /\\^/");
|
||||
assert(/\$/u.test("$"), "IdentityEscape in AtomEscape: /\\$/");
|
||||
assert(/\\/u.test("\\"), "IdentityEscape in AtomEscape: /\\\\/");
|
||||
assert(/\./u.test("."), "IdentityEscape in AtomEscape: /\\./");
|
||||
assert(/\*/u.test("*"), "IdentityEscape in AtomEscape: /\\*/");
|
||||
assert(/\+/u.test("+"), "IdentityEscape in AtomEscape: /\\+/");
|
||||
assert(/\?/u.test("?"), "IdentityEscape in AtomEscape: /\\?/");
|
||||
assert(/\(/u.test("("), "IdentityEscape in AtomEscape: /\\(/");
|
||||
assert(/\)/u.test(")"), "IdentityEscape in AtomEscape: /\\)/");
|
||||
assert(/\[/u.test("["), "IdentityEscape in AtomEscape: /\\[/");
|
||||
assert(/\]/u.test("]"), "IdentityEscape in AtomEscape: /\\]/");
|
||||
assert(/\{/u.test("{"), "IdentityEscape in AtomEscape: /\\{/");
|
||||
assert(/\}/u.test("}"), "IdentityEscape in AtomEscape: /\\}/");
|
||||
assert(/\|/u.test("|"), "IdentityEscape in AtomEscape: /\\|/");
|
||||
assert(/\//u.test("/"), "IdentityEscape in AtomEscape: /\\//");
|
||||
|
||||
|
||||
// IdentityEscape in ClassEscape
|
||||
assert(/[\^]/u.test("^"));
|
||||
assert(/[\$]/u.test("$"));
|
||||
assert(/[\\]/u.test("\\"));
|
||||
assert(/[\.]/u.test("."));
|
||||
assert(/[\*]/u.test("*"));
|
||||
assert(/[\+]/u.test("+"));
|
||||
assert(/[\?]/u.test("?"));
|
||||
assert(/[\(]/u.test("("));
|
||||
assert(/[\)]/u.test(")"));
|
||||
assert(/[\[]/u.test("["));
|
||||
assert(/[\]]/u.test("]"));
|
||||
assert(/[\{]/u.test("{"));
|
||||
assert(/[\}]/u.test("}"));
|
||||
assert(/[\|]/u.test("|"));
|
||||
assert(/[\/]/u.test("/"));
|
||||
assert(/[\^]/u.test("^"), "IdentityEscape in ClassEscape: /[\\^]/");
|
||||
assert(/[\$]/u.test("$"), "IdentityEscape in ClassEscape: /[\\$]/");
|
||||
assert(/[\\]/u.test("\\"), "IdentityEscape in ClassEscape: /[\\\\]/");
|
||||
assert(/[\.]/u.test("."), "IdentityEscape in ClassEscape: /[\\.]/");
|
||||
assert(/[\*]/u.test("*"), "IdentityEscape in ClassEscape: /[\\*]/");
|
||||
assert(/[\+]/u.test("+"), "IdentityEscape in ClassEscape: /[\\+]/");
|
||||
assert(/[\?]/u.test("?"), "IdentityEscape in ClassEscape: /[\\?]/");
|
||||
assert(/[\(]/u.test("("), "IdentityEscape in ClassEscape: /[\\(]/");
|
||||
assert(/[\)]/u.test(")"), "IdentityEscape in ClassEscape: /[\\)]/");
|
||||
assert(/[\[]/u.test("["), "IdentityEscape in ClassEscape: /[\\[]/");
|
||||
assert(/[\]]/u.test("]"), "IdentityEscape in ClassEscape: /[\\]]/");
|
||||
assert(/[\{]/u.test("{"), "IdentityEscape in ClassEscape: /[\\{]/");
|
||||
assert(/[\}]/u.test("}"), "IdentityEscape in ClassEscape: /[\\}]/");
|
||||
assert(/[\|]/u.test("|"), "IdentityEscape in ClassEscape: /[\\|]/");
|
||||
assert(/[\/]/u.test("/"), "IdentityEscape in ClassEscape: /[\\/]/");
|
||||
|
|
|
@ -11,9 +11,21 @@ es6id: 21.1.2
|
|||
---*/
|
||||
|
||||
// Single parentheses and brackets.
|
||||
assert.throws(SyntaxError, function() { RegExp("(", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp(")", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("{", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("}", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(", "u");
|
||||
}, 'RegExp("(", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp(")", "u");
|
||||
}, 'RegExp(")", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[", "u");
|
||||
}, 'RegExp("[", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("]", "u");
|
||||
}, 'RegExp("]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("{", "u");
|
||||
}, 'RegExp("{", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("}", "u");
|
||||
}, 'RegExp("}", "u"): ');
|
||||
|
|
|
@ -11,27 +11,63 @@ es6id: 21.2.2.15.1
|
|||
---*/
|
||||
|
||||
// Leading CharacterClassEscape.
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\d-a]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\D-a]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\s-a]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\S-a]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\w-a]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\W-a]", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\d-a]", "u");
|
||||
}, 'RegExp("[\\d-a]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\D-a]", "u");
|
||||
}, 'RegExp("[\\D-a]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\s-a]", "u");
|
||||
}, 'RegExp("[\\s-a]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\S-a]", "u");
|
||||
}, 'RegExp("[\\S-a]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\w-a]", "u");
|
||||
}, 'RegExp("[\\w-a]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\W-a]", "u");
|
||||
}, 'RegExp("[\\W-a]", "u"): ');
|
||||
|
||||
|
||||
// Trailing CharacterClassEscape.
|
||||
assert.throws(SyntaxError, function() { RegExp("[a-\\d]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[a-\\D]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[a-\\s]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[a-\\S]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[a-\\w]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[a-\\W]", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[a-\\d]", "u");
|
||||
}, 'RegExp("[a-\\d]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[a-\\D]", "u");
|
||||
}, 'RegExp("[a-\\D]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[a-\\s]", "u");
|
||||
}, 'RegExp("[a-\\s]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[a-\\S]", "u");
|
||||
}, 'RegExp("[a-\\S]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[a-\\w]", "u");
|
||||
}, 'RegExp("[a-\\w]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[a-\\W]", "u");
|
||||
}, 'RegExp("[a-\\W]", "u"): ');
|
||||
|
||||
|
||||
// Leading and trailing CharacterClassEscape.
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\d-\\d]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\D-\\D]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\s-\\s]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\S-\\S]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\w-\\w]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\W-\\W]", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\d-\\d]", "u");
|
||||
}, 'RegExp("[\\d-\\d]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\D-\\D]", "u");
|
||||
}, 'RegExp("[\\D-\\D]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\s-\\s]", "u");
|
||||
}, 'RegExp("[\\s-\\s]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\S-\\S]", "u");
|
||||
}, 'RegExp("[\\S-\\S]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\w-\\w]", "u");
|
||||
}, 'RegExp("[\\w-\\w]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\W-\\W]", "u");
|
||||
}, 'RegExp("[\\W-\\W]", "u"): ');
|
||||
|
|
|
@ -46,7 +46,7 @@ for (var cu = 0x00; cu <= 0x7f; ++cu) {
|
|||
if (!isAlphaDigit(s) && !isSyntaxCharacter(s) && s !== "/") {
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\" + s, "u");
|
||||
}, "Invalid IdentityEscape '\\" + s + "'");
|
||||
}, "Invalid IdentityEscape in AtomEscape: '\\" + s + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,6 @@ for (var cu = 0x00; cu <= 0x7f; ++cu) {
|
|||
if (!isAlphaDigit(s) && !isSyntaxCharacter(s) && s !== "/" && s !== "-") {
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\" + s + "]", "u");
|
||||
}, "Invalid IdentityEscape '\\" + s + "'");
|
||||
}, "Invalid IdentityEscape in ClassEscape: '\\" + s + "'");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ for (var cu = 0x41 /* A */; cu <= 0x5a /* Z */; ++cu) {
|
|||
if (!isValidAlphaEscapeInAtom(s)) {
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\" + s, "u");
|
||||
}, "IdentityEscape '" + s + "'");
|
||||
}, "IdentityEscape in AtomEscape: '" + s + "'");
|
||||
}
|
||||
}
|
||||
for (var cu = 0x61 /* a */; cu <= 0x7a /* z */; ++cu) {
|
||||
|
@ -76,7 +76,7 @@ for (var cu = 0x61 /* a */; cu <= 0x7a /* z */; ++cu) {
|
|||
if (!isValidAlphaEscapeInAtom(s)) {
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\" + s, "u");
|
||||
}, "IdentityEscape '" + s + "'");
|
||||
}, "IdentityEscape in AtomEscape: '" + s + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ for (var cu = 0x41 /* A */; cu <= 0x5a /* Z */; ++cu) {
|
|||
if (!isValidAlphaEscapeInClass(s)) {
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\" + s + "]", "u");
|
||||
}, "IdentityEscape '" + s + "'");
|
||||
}, "IdentityEscape in ClassEscape: '" + s + "'");
|
||||
}
|
||||
}
|
||||
for (var cu = 0x61 /* a */; cu <= 0x7a /* z */; ++cu) {
|
||||
|
@ -95,6 +95,6 @@ for (var cu = 0x61 /* a */; cu <= 0x7a /* z */; ++cu) {
|
|||
if (!isValidAlphaEscapeInClass(s)) {
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\" + s + "]", "u");
|
||||
}, "IdentityEscape '" + s + "'");
|
||||
}, "IdentityEscape in ClassEscape: '" + s + "'");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ for (var cu = 0x00; cu <= 0x7f; ++cu) {
|
|||
if (!isAlpha(s)) {
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\c" + s, "u");
|
||||
}, "ControlLetter '" + s + "'");
|
||||
}, "ControlLetter escape in AtomEscape: '" + s + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,6 @@ for (var cu = 0x00; cu <= 0x7f; ++cu) {
|
|||
if (!isAlpha(s)) {
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\c" + s + "]", "u");
|
||||
}, "ControlLetter '" + s + "'");
|
||||
}, "ControlLetter escape in ClassEscape: '" + s + "'");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,27 +14,63 @@ es6id: 21.1.2
|
|||
//
|
||||
// AtomEscape[U] :: CharacterEscape[?U]
|
||||
// CharacterEscape[U] :: RegExpUnicodeEscapeSequence[?U]
|
||||
assert.throws(SyntaxError, function() { RegExp("\\u", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\u1", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\u12", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\u123", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\u{", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\u{}", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\u{1", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\u{12", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\u{123", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\u", "u");
|
||||
}, 'RegExp("\\u", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\u1", "u");
|
||||
}, 'RegExp("\\u1", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\u12", "u");
|
||||
}, 'RegExp("\\u12", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\u123", "u");
|
||||
}, 'RegExp("\\u123", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\u{", "u");
|
||||
}, 'RegExp("\\u{", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\u{}", "u");
|
||||
}, 'RegExp("\\u{}", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\u{1", "u");
|
||||
}, 'RegExp("\\u{1", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\u{12", "u");
|
||||
}, 'RegExp("\\u{12", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\u{123", "u");
|
||||
}, 'RegExp("\\u{123", "u"): ');
|
||||
|
||||
|
||||
// Incomplete RegExpUnicodeEscapeSequence in ClassEscape not parsed as IdentityEscape.
|
||||
//
|
||||
// ClassEscape[U] :: CharacterEscape[?U]
|
||||
// CharacterEscape[U] :: RegExpUnicodeEscapeSequence[?U]
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\u]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\u1]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\u12]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\u123]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\u{]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\u{}]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\u{1]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\u{12]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\u{123]", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\u]", "u");
|
||||
}, 'RegExp("[\\u]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\u1]", "u");
|
||||
}, 'RegExp("[\\u1]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\u12]", "u");
|
||||
}, 'RegExp("[\\u12]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\u123]", "u");
|
||||
}, 'RegExp("[\\u123]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\u{]", "u");
|
||||
}, 'RegExp("[\\u{]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\u{}]", "u");
|
||||
}, 'RegExp("[\\u{}]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\u{1]", "u");
|
||||
}, 'RegExp("[\\u{1]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\u{12]", "u");
|
||||
}, 'RegExp("[\\u{12]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\u{123]", "u");
|
||||
}, 'RegExp("[\\u{123]", "u"): ');
|
||||
|
|
|
@ -14,13 +14,21 @@ es6id: 21.1.2
|
|||
//
|
||||
// AtomEscape[U] :: CharacterEscape[?U]
|
||||
// CharacterEscape[U] :: HexEscapeSequence
|
||||
assert.throws(SyntaxError, function() { RegExp("\\x", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\x1", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\x", "u");
|
||||
}, 'RegExp("\\x", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\x1", "u");
|
||||
}, 'RegExp("\\x1", "u"): ');
|
||||
|
||||
|
||||
// Incomplete HexEscapeSequence in ClassEscape not parsed as IdentityEscape.
|
||||
//
|
||||
// ClassEscape[U] :: CharacterEscape[?U]
|
||||
// CharacterEscape[U] :: HexEscapeSequence
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\x]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\x1]", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\x]", "u");
|
||||
}, 'RegExp("[\\x]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\x1]", "u");
|
||||
}, 'RegExp("[\\x1]", "u"): ');
|
||||
|
|
|
@ -11,14 +11,30 @@ es6id: 21.1.2
|
|||
---*/
|
||||
|
||||
// Incomplete quantifier with atom.
|
||||
assert.throws(SyntaxError, function() { RegExp("a{", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("a{1", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("a{1,", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("a{1,2", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("a{", "u");
|
||||
}, 'RegExp("a{", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("a{1", "u");
|
||||
}, 'RegExp("a{1", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("a{1,", "u");
|
||||
}, 'RegExp("a{1,", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("a{1,2", "u");
|
||||
}, 'RegExp("a{1,2", "u"): ');
|
||||
|
||||
|
||||
// Incomplete quantifier without atom.
|
||||
assert.throws(SyntaxError, function() { RegExp("{", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("{1", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("{1,", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("{1,2", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("{", "u");
|
||||
}, 'RegExp("{", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("{1", "u");
|
||||
}, 'RegExp("{1", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("{1,", "u");
|
||||
}, 'RegExp("{1,", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("{1,2", "u");
|
||||
}, 'RegExp("{1,2", "u"): ');
|
||||
|
|
|
@ -14,59 +14,135 @@ es6id: 21.1.2
|
|||
//
|
||||
// AtomEscape[U] :: DecimalEscape
|
||||
// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit]
|
||||
assert.throws(SyntaxError, function() { RegExp("\\1", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\2", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\3", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\4", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\5", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\6", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\7", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\8", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\9", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\1", "u");
|
||||
}, 'RegExp("\\1", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\2", "u");
|
||||
}, 'RegExp("\\2", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\3", "u");
|
||||
}, 'RegExp("\\3", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\4", "u");
|
||||
}, 'RegExp("\\4", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\5", "u");
|
||||
}, 'RegExp("\\5", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\6", "u");
|
||||
}, 'RegExp("\\6", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\7", "u");
|
||||
}, 'RegExp("\\7", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\8", "u");
|
||||
}, 'RegExp("\\8", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\9", "u");
|
||||
}, 'RegExp("\\9", "u"): ');
|
||||
|
||||
|
||||
// DecimalEscape without leading 0 in ClassEscape.
|
||||
//
|
||||
// ClassEscape[U] :: DecimalEscape
|
||||
// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit]
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\1]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\2]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\3]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\4]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\5]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\6]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\7]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\8]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\9]", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\1]", "u");
|
||||
}, 'RegExp("[\\1]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\2]", "u");
|
||||
}, 'RegExp("[\\2]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\3]", "u");
|
||||
}, 'RegExp("[\\3]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\4]", "u");
|
||||
}, 'RegExp("[\\4]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\5]", "u");
|
||||
}, 'RegExp("[\\5]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\6]", "u");
|
||||
}, 'RegExp("[\\6]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\7]", "u");
|
||||
}, 'RegExp("[\\7]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\8]", "u");
|
||||
}, 'RegExp("[\\8]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\9]", "u");
|
||||
}, 'RegExp("[\\9]", "u"): ');
|
||||
|
||||
|
||||
// DecimalEscape with leading 0 in AtomEscape.
|
||||
//
|
||||
// Atom[U] :: DecimalEscape
|
||||
// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit]
|
||||
assert.throws(SyntaxError, function() { RegExp("\\00", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\01", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\02", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\03", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\04", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\05", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\06", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\07", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\08", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("\\09", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\00", "u");
|
||||
}, 'RegExp("\\00", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\01", "u");
|
||||
}, 'RegExp("\\01", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\02", "u");
|
||||
}, 'RegExp("\\02", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\03", "u");
|
||||
}, 'RegExp("\\03", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\04", "u");
|
||||
}, 'RegExp("\\04", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\05", "u");
|
||||
}, 'RegExp("\\05", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\06", "u");
|
||||
}, 'RegExp("\\06", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\07", "u");
|
||||
}, 'RegExp("\\07", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\08", "u");
|
||||
}, 'RegExp("\\08", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\09", "u");
|
||||
}, 'RegExp("\\09", "u"): ');
|
||||
|
||||
|
||||
// DecimalEscape with leading 0 in ClassEscape.
|
||||
//
|
||||
// ClassEscape[U] :: DecimalEscape
|
||||
// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit]
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\00]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\01]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\02]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\03]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\04]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\05]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\06]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\07]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\08]", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\09]", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\00]", "u");
|
||||
}, 'RegExp("[\\00]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\01]", "u");
|
||||
}, 'RegExp("[\\01]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\02]", "u");
|
||||
}, 'RegExp("[\\02]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\03]", "u");
|
||||
}, 'RegExp("[\\03]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\04]", "u");
|
||||
}, 'RegExp("[\\04]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\05]", "u");
|
||||
}, 'RegExp("[\\05]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\06]", "u");
|
||||
}, 'RegExp("[\\06]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\07]", "u");
|
||||
}, 'RegExp("[\\07]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\08]", "u");
|
||||
}, 'RegExp("[\\08]", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\09]", "u");
|
||||
}, 'RegExp("[\\09]", "u"): ');
|
||||
|
|
|
@ -11,36 +11,84 @@ es6id: 21.1.2
|
|||
---*/
|
||||
|
||||
// Positive lookahead with quantifier.
|
||||
assert.throws(SyntaxError, function() { RegExp("(?=.)*", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?=.)+", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?=.)?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?=.){1}", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?=.){1,}", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?=.){1,2}", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?=.)*", "u");
|
||||
}, 'RegExp("(?=.)*", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?=.)+", "u");
|
||||
}, 'RegExp("(?=.)+", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?=.)?", "u");
|
||||
}, 'RegExp("(?=.)?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?=.){1}", "u");
|
||||
}, 'RegExp("(?=.){1}", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?=.){1,}", "u");
|
||||
}, 'RegExp("(?=.){1,}", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?=.){1,2}", "u");
|
||||
}, 'RegExp("(?=.){1,2}", "u"): ');
|
||||
|
||||
|
||||
// Positive lookahead with reluctant quantifier.
|
||||
assert.throws(SyntaxError, function() { RegExp("(?=.)*?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?=.)+?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?=.)??", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?=.){1}?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?=.){1,}?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?=.){1,2}?", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?=.)*?", "u");
|
||||
}, 'RegExp("(?=.)*?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?=.)+?", "u");
|
||||
}, 'RegExp("(?=.)+?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?=.)??", "u");
|
||||
}, 'RegExp("(?=.)??", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?=.){1}?", "u");
|
||||
}, 'RegExp("(?=.){1}?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?=.){1,}?", "u");
|
||||
}, 'RegExp("(?=.){1,}?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?=.){1,2}?", "u");
|
||||
}, 'RegExp("(?=.){1,2}?", "u"): ');
|
||||
|
||||
|
||||
// Negative lookahead with quantifier.
|
||||
assert.throws(SyntaxError, function() { RegExp("(?!.)*", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?!.)+", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?!.)?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?!.){1}", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?!.){1,}", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?!.){1,2}", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?!.)*", "u");
|
||||
}, 'RegExp("(?!.)*", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?!.)+", "u");
|
||||
}, 'RegExp("(?!.)+", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?!.)?", "u");
|
||||
}, 'RegExp("(?!.)?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?!.){1}", "u");
|
||||
}, 'RegExp("(?!.){1}", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?!.){1,}", "u");
|
||||
}, 'RegExp("(?!.){1,}", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?!.){1,2}", "u");
|
||||
}, 'RegExp("(?!.){1,2}", "u"): ');
|
||||
|
||||
|
||||
// Negative lookahead with reluctant quantifier.
|
||||
assert.throws(SyntaxError, function() { RegExp("(?!.)*?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?!.)+?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?!.)??", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?!.){1}?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?!.){1,}?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("(?!.){1,2}?", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?!.)*?", "u");
|
||||
}, 'RegExp("(?!.)*?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?!.)+?", "u");
|
||||
}, 'RegExp("(?!.)+?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?!.)??", "u");
|
||||
}, 'RegExp("(?!.)??", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?!.){1}?", "u");
|
||||
}, 'RegExp("(?!.){1}?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?!.){1,}?", "u");
|
||||
}, 'RegExp("(?!.){1,}?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("(?!.){1,2}?", "u");
|
||||
}, 'RegExp("(?!.){1,2}?", "u"): ');
|
||||
|
|
|
@ -11,18 +11,42 @@ es6id: 21.1.2
|
|||
---*/
|
||||
|
||||
// Quantifier without atom.
|
||||
assert.throws(SyntaxError, function() { RegExp("*", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("+", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("{1}", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("{1,}", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("{1,2}", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("*", "u");
|
||||
}, 'RegExp("*", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("+", "u");
|
||||
}, 'RegExp("+", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("?", "u");
|
||||
}, 'RegExp("?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("{1}", "u");
|
||||
}, 'RegExp("{1}", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("{1,}", "u");
|
||||
}, 'RegExp("{1,}", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("{1,2}", "u");
|
||||
}, 'RegExp("{1,2}", "u"): ');
|
||||
|
||||
|
||||
// Reluctant quantifier without atom.
|
||||
assert.throws(SyntaxError, function() { RegExp("*?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("+?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("??", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("{1}?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("{1,}?", "u"); });
|
||||
assert.throws(SyntaxError, function() { RegExp("{1,2}?", "u"); });
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("*?", "u");
|
||||
}, 'RegExp("*?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("+?", "u");
|
||||
}, 'RegExp("+?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("??", "u");
|
||||
}, 'RegExp("??", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("{1}?", "u");
|
||||
}, 'RegExp("{1}?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("{1,}?", "u");
|
||||
}, 'RegExp("{1,}?", "u"): ');
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("{1,2}?", "u");
|
||||
}, 'RegExp("{1,2}?", "u"): ');
|
||||
|
|
Loading…
Reference in New Issue