diff options
Diffstat (limited to 'test/built-ins')
12 files changed, 422 insertions, 166 deletions
diff --git a/test/built-ins/RegExp/unicode_identity_escape.js b/test/built-ins/RegExp/unicode_identity_escape.js index ca32e9031..67be1a0b3 100755 --- a/test/built-ins/RegExp/unicode_identity_escape.js +++ b/test/built-ins/RegExp/unicode_identity_escape.js @@ -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: /[\\/]/"); diff --git a/test/built-ins/RegExp/unicode_restricted_brackets.js b/test/built-ins/RegExp/unicode_restricted_brackets.js index a58818051..30d245c6f 100755 --- a/test/built-ins/RegExp/unicode_restricted_brackets.js +++ b/test/built-ins/RegExp/unicode_restricted_brackets.js @@ -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"): '); diff --git a/test/built-ins/RegExp/unicode_restricted_character_class_escape.js b/test/built-ins/RegExp/unicode_restricted_character_class_escape.js index d2eb4ac82..4dff53927 100755 --- a/test/built-ins/RegExp/unicode_restricted_character_class_escape.js +++ b/test/built-ins/RegExp/unicode_restricted_character_class_escape.js @@ -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"): '); diff --git a/test/built-ins/RegExp/unicode_restricted_identity_escape.js b/test/built-ins/RegExp/unicode_restricted_identity_escape.js index a53656122..b601c0f71 100755 --- a/test/built-ins/RegExp/unicode_restricted_identity_escape.js +++ b/test/built-ins/RegExp/unicode_restricted_identity_escape.js @@ -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 + "'"); } } diff --git a/test/built-ins/RegExp/unicode_restricted_identity_escape_alpha.js b/test/built-ins/RegExp/unicode_restricted_identity_escape_alpha.js index 34322d791..3b6e53bdb 100755 --- a/test/built-ins/RegExp/unicode_restricted_identity_escape_alpha.js +++ b/test/built-ins/RegExp/unicode_restricted_identity_escape_alpha.js @@ -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 + "'"); } } diff --git a/test/built-ins/RegExp/unicode_restricted_identity_escape_c.js b/test/built-ins/RegExp/unicode_restricted_identity_escape_c.js index 74a9239f8..4849a91c4 100755 --- a/test/built-ins/RegExp/unicode_restricted_identity_escape_c.js +++ b/test/built-ins/RegExp/unicode_restricted_identity_escape_c.js @@ -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 + "'"); } } diff --git a/test/built-ins/RegExp/unicode_restricted_identity_escape_u.js b/test/built-ins/RegExp/unicode_restricted_identity_escape_u.js index 4795ab400..701a38721 100755 --- a/test/built-ins/RegExp/unicode_restricted_identity_escape_u.js +++ b/test/built-ins/RegExp/unicode_restricted_identity_escape_u.js @@ -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"): '); diff --git a/test/built-ins/RegExp/unicode_restricted_identity_escape_x.js b/test/built-ins/RegExp/unicode_restricted_identity_escape_x.js index 1b32ac98c..c02c7f85b 100755 --- a/test/built-ins/RegExp/unicode_restricted_identity_escape_x.js +++ b/test/built-ins/RegExp/unicode_restricted_identity_escape_x.js @@ -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"): '); diff --git a/test/built-ins/RegExp/unicode_restricted_incomple_quantifier.js b/test/built-ins/RegExp/unicode_restricted_incomple_quantifier.js index a75c3ab3f..93858feda 100755 --- a/test/built-ins/RegExp/unicode_restricted_incomple_quantifier.js +++ b/test/built-ins/RegExp/unicode_restricted_incomple_quantifier.js @@ -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"): '); diff --git a/test/built-ins/RegExp/unicode_restricted_octal_escape.js b/test/built-ins/RegExp/unicode_restricted_octal_escape.js index e2b075a24..3e08e7a15 100755 --- a/test/built-ins/RegExp/unicode_restricted_octal_escape.js +++ b/test/built-ins/RegExp/unicode_restricted_octal_escape.js @@ -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"): '); diff --git a/test/built-ins/RegExp/unicode_restricted_quantifiable_assertion.js b/test/built-ins/RegExp/unicode_restricted_quantifiable_assertion.js index 75530772d..45c281d09 100755 --- a/test/built-ins/RegExp/unicode_restricted_quantifiable_assertion.js +++ b/test/built-ins/RegExp/unicode_restricted_quantifiable_assertion.js @@ -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"): '); diff --git a/test/built-ins/RegExp/unicode_restricted_quantifier_without_atom.js b/test/built-ins/RegExp/unicode_restricted_quantifier_without_atom.js index 371cc7181..0a584bb91 100755 --- a/test/built-ins/RegExp/unicode_restricted_quantifier_without_atom.js +++ b/test/built-ins/RegExp/unicode_restricted_quantifier_without_atom.js @@ -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"): '); |