mirror of https://github.com/tc39/test262.git
B.1.4 extensions are not allowed for Unicode RegExps
This commit is contained in:
parent
f4e17963f8
commit
a4205bac61
|
@ -51,24 +51,30 @@ assert.notSameValue = function (actual, unexpected, message) {
|
|||
$ERROR(message);
|
||||
};
|
||||
|
||||
assert.throws = function (expectedErrorConstructor, func) {
|
||||
assert.throws = function (expectedErrorConstructor, func, message) {
|
||||
if (func === undefined) {
|
||||
$ERROR('assert.throws requires two arguments: the error constructor and a function to run');
|
||||
return;
|
||||
}
|
||||
if (message === undefined) {
|
||||
message = '';
|
||||
} else {
|
||||
message += ' ';
|
||||
}
|
||||
|
||||
try {
|
||||
func();
|
||||
} catch (thrown) {
|
||||
if (typeof thrown !== 'object' || thrown === null) {
|
||||
$ERROR('Thrown value was not an object!');
|
||||
return;
|
||||
}
|
||||
if (thrown.constructor !== expectedErrorConstructor) {
|
||||
$ERROR('Expected a ' + expectedErrorConstructor.name + ' but got a ' + thrown.constructor.name);
|
||||
message += 'Thrown value was not an object!';
|
||||
$ERROR(message);
|
||||
} else if (thrown.constructor !== expectedErrorConstructor) {
|
||||
message += 'Expected a ' + expectedErrorConstructor.name + ' but got a ' + thrown.constructor.name;
|
||||
$ERROR(message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$ERROR('Expected a ' + expectedErrorConstructor.name + ' to be thrown but no exception was thrown at all');
|
||||
message += 'Expected a ' + expectedErrorConstructor.name + ' to be thrown but no exception was thrown at all';
|
||||
$ERROR(message);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Extension B.1.4 is not applied for Unicode RegExp
|
||||
info: >
|
||||
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
|
||||
are not applied for Unicode RegExp.
|
||||
Tested extension: "Atom[U] :: PatternCharacter"
|
||||
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"); });
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Extension B.1.4 is not applied for Unicode RegExp
|
||||
info: >
|
||||
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
|
||||
are not applied for Unicode RegExp.
|
||||
Tested extension: "ClassAtomNoDashInRange :: \ ClassEscape but only if ClassEscape evaluates to a CharSet with exactly one character"
|
||||
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"); });
|
||||
|
||||
|
||||
// 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"); });
|
||||
|
||||
|
||||
// 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"); });
|
|
@ -0,0 +1,65 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Extension B.1.4 is not applied for Unicode RegExp
|
||||
info: >
|
||||
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
|
||||
are not applied for Unicode RegExps.
|
||||
Tested extension: "IdentityEscape[U] :: [~U] SourceCharacter but not c"
|
||||
es6id: 21.1.2
|
||||
---*/
|
||||
|
||||
function isSyntaxCharacter(c) {
|
||||
switch (c) {
|
||||
case "^":
|
||||
case "$":
|
||||
case "\\":
|
||||
case ".":
|
||||
case "*":
|
||||
case "+":
|
||||
case "?":
|
||||
case "(":
|
||||
case ")":
|
||||
case "[":
|
||||
case "]":
|
||||
case "{":
|
||||
case "}":
|
||||
case "|":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isAlphaDigit(c) {
|
||||
return ("0" <= c && c <= "9") || ("A" <= c && c <= "Z") || ("a" <= c && c <= "z");
|
||||
}
|
||||
|
||||
|
||||
// IdentityEscape in AtomEscape.
|
||||
//
|
||||
// AtomEscape[U] :: CharacterEscape[?U]
|
||||
// CharacterEscape[U] :: IdentityEscape[?U]
|
||||
for (var cu = 0x00; cu <= 0x7f; ++cu) {
|
||||
var s = String.fromCharCode(cu);
|
||||
if (!isAlphaDigit(s) && !isSyntaxCharacter(s) && s !== "/") {
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\" + s, "u");
|
||||
}, "Invalid IdentityEscape '\\" + s + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// IdentityEscape in ClassEscape.
|
||||
//
|
||||
// ClassEscape[U] :: CharacterEscape[?U]
|
||||
// CharacterEscape[U] :: IdentityEscape[?U]
|
||||
for (var cu = 0x00; cu <= 0x7f; ++cu) {
|
||||
var s = String.fromCharCode(cu);
|
||||
if (!isAlphaDigit(s) && !isSyntaxCharacter(s) && s !== "/" && s !== "-") {
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\" + s + "]", "u");
|
||||
}, "Invalid IdentityEscape '\\" + s + "'");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Extension B.1.4 is not applied for Unicode RegExp
|
||||
info: >
|
||||
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
|
||||
are not applied for Unicode RegExp.
|
||||
Tested extension: "IdentityEscape[U] :: [~U] SourceCharacter but not c"
|
||||
es6id: 21.1.2
|
||||
---*/
|
||||
|
||||
function isAlpha(c) {
|
||||
return ("A" <= c && c <= "Z") || ("a" <= c && c <= "z");
|
||||
}
|
||||
|
||||
|
||||
// "c ControlLetter" sequence in AtomEscape.
|
||||
//
|
||||
// AtomEscape[U] :: CharacterEscape[?U]
|
||||
// CharacterEscape[U] :: c ControlLetter
|
||||
assert.throws(SyntaxError, function() { RegExp("\\c", "u"); });
|
||||
for (var cu = 0x00; cu <= 0x7f; ++cu) {
|
||||
var s = String.fromCharCode(cu);
|
||||
if (!isAlpha(s)) {
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("\\c" + s, "u");
|
||||
}, "ControlLetter '" + s + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// "c ControlLetter" sequence in ClassEscape.
|
||||
//
|
||||
// ClassEscape[U] :: CharacterEscape[?U]
|
||||
// CharacterEscape[U] :: c ControlLetter
|
||||
assert.throws(SyntaxError, function() { RegExp("[\\c]", "u"); });
|
||||
for (var cu = 0x00; cu <= 0x7f; ++cu) {
|
||||
var s = String.fromCharCode(cu);
|
||||
if (!isAlpha(s)) {
|
||||
assert.throws(SyntaxError, function() {
|
||||
RegExp("[\\c" + s + "]", "u");
|
||||
}, "ControlLetter '" + s + "'");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Extension B.1.4 is not applied for Unicode RegExp
|
||||
info: >
|
||||
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
|
||||
are not applied for Unicode RegExp.
|
||||
Tested extension: "IdentityEscape[U] :: [~U] SourceCharacter but not c"
|
||||
es6id: 21.1.2
|
||||
---*/
|
||||
|
||||
// Incomplete RegExpUnicodeEscapeSequence in AtomEscape not parsed as IdentityEscape.
|
||||
//
|
||||
// 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"); });
|
||||
|
||||
|
||||
// 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"); });
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Extension B.1.4 is not applied for Unicode RegExp
|
||||
info: >
|
||||
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
|
||||
are not applied for Unicode RegExp.
|
||||
Tested extension: "IdentityEscape[U] :: [~U] SourceCharacter but not c"
|
||||
es6id: 21.1.2
|
||||
---*/
|
||||
|
||||
// Incomplete HexEscapeSequence in AtomEscape not parsed as IdentityEscape.
|
||||
//
|
||||
// AtomEscape[U] :: CharacterEscape[?U]
|
||||
// CharacterEscape[U] :: HexEscapeSequence
|
||||
assert.throws(SyntaxError, function() { RegExp("\\x", "u"); });
|
||||
assert.throws(SyntaxError, function() { 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"); });
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Extension B.1.4 is not applied for Unicode RegExp
|
||||
info: >
|
||||
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
|
||||
are not applied for Unicode RegExp.
|
||||
Tested extension: "Atom[U] :: PatternCharacter"
|
||||
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"); });
|
||||
|
||||
|
||||
// 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"); });
|
|
@ -0,0 +1,72 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Extension B.1.4 is not applied for Unicode RegExp
|
||||
info: >
|
||||
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
|
||||
are not applied for Unicode RegExp.
|
||||
Tested extension: "CharacterEscape[U] :: [~U] LegacyOctalEscapeSequence"
|
||||
es6id: 21.1.2
|
||||
---*/
|
||||
|
||||
// DecimalEscape without leading 0 in AtomEscape.
|
||||
//
|
||||
// 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"); });
|
||||
|
||||
|
||||
// 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"); });
|
||||
|
||||
|
||||
// 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"); });
|
||||
|
||||
|
||||
// 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"); });
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Extension B.1.4 is not applied for Unicode RegExp
|
||||
info: >
|
||||
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
|
||||
are not applied for Unicode RegExps.
|
||||
Tested extension: "ExtendedTerm :: QuantifiableAssertion Quantifier"
|
||||
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"); });
|
||||
|
||||
|
||||
// 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"); });
|
||||
|
||||
|
||||
// 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"); });
|
||||
|
||||
|
||||
// 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"); });
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Extension B.1.4 is not applied for Unicode RegExp
|
||||
info: >
|
||||
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
|
||||
are not applied for Unicode RegExp.
|
||||
Tested extension: "Atom[U] :: PatternCharacter"
|
||||
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"); });
|
||||
|
||||
|
||||
// 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"); });
|
Loading…
Reference in New Issue