test/language/literals/regexp/*: early error test fixups (#1276)

This commit is contained in:
Rick Waldron 2017-10-16 12:46:28 -04:00 committed by Leo Balter
parent e6df79231d
commit 5d4c667b27
46 changed files with 698 additions and 185 deletions

View File

@ -2,14 +2,28 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 7.8.5-1
description: >
Literal RegExp Objects - SyntaxError exception is thrown if the
RegularExpressionNonTerminator position of a
esid: prod-RegularExpressionBackslashSequence
info: |
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
SyntaxError exception is thrown if the RegularExpressionNonTerminator position of a
RegularExpressionBackslashSequence is a LineTerminator.
description: >
A RegularExpressionBackslashSequence may not contain a LineTerminator.
---*/
assert.throws(SyntaxError, function() {
eval("var regExp = /\\\rn/;");
eval("/\\\rn/;");
/*
The result of this string is:
"/\
n/;"
*/
});

View File

@ -2,13 +2,34 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 7.8.5-1gs
description: Empty literal RegExp should result in a SyntaxError
negative:
phase: early
type: SyntaxError
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionLiteral ::
/ RegularExpressionBody / RegularExpressionFlags
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
SourceCharacter ::
any Unicode code point
RegularExpressionNonTerminator::
SourceCharacter but not LineTerminator
description: >
RegularExpressionBody will never be empty, because RegularExpressionFirstChar must always be _something_. // is a comment.
---*/
throw "Test262: This statement should not be evaluated.";
var y = 42;
var x = //.source;
y;
assert.sameValue(x, y);
var re = //;

View File

@ -2,7 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
info: |
RegularExpressionFirstChar :: NonTerminator but not * or \ or /,
RegularExpressionChars :: [empty], RegularExpressionFlags :: [empty]
es5id: 7.8.5_A1.1_T1
@ -12,7 +12,7 @@ description: Without eval
//CHECK#1
if (/1/.source !== "1") {
$ERROR('#1: /1/');
}
}
//CHECK#2
if (/a/.source !== "a") {

View File

@ -2,9 +2,17 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionFirstChar :: * or \\ or / or [empty] is incorrect"
es5id: 7.8.5_A1.2_T1
description: "*"
esid: prod-RegularExpressionFirstChar
info: |
RegularExpressionChars ::
[empty]
RegularExpressionCharsRegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
description: >
The first character of a regular expression may not be "*"
negative:
phase: early
type: SyntaxError
@ -12,5 +20,4 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
/*/

View File

@ -2,9 +2,20 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionFirstChar :: * or \\ or / or [empty] is incorrect"
es5id: 7.8.5_A1.2_T2
description: \
esid: sec-literals-regular-expression-literals
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
description: >
The first character of a regular expression may not be "\"
negative:
phase: early
type: SyntaxError
@ -12,5 +23,4 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
/\/

View File

@ -2,9 +2,20 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionFirstChar :: * or \\ or / or [empty] is incorrect"
es5id: 7.8.5_A1.2_T3
description: /
esid: sec-literals-regular-expression-literals
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
description: >
The first character of a regular expression may not be "/"
negative:
phase: early
type: SyntaxError
@ -12,6 +23,5 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
///
.source;

View File

@ -2,9 +2,20 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionFirstChar :: * or \\ or / or [empty] is incorrect"
es5id: 7.8.5_A1.2_T4
description: "[empty]"
esid: sec-literals-regular-expression-literals
info: |
RegularExpressionLiteral::
/ RegularExpressionBody / RegularExpressionFlags
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars::
[empty]
MemberExpression . IdentifierName
description: A regular expression may not be empty.
negative:
phase: early
type: SyntaxError
@ -12,6 +23,5 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
//
.source;

View File

@ -2,9 +2,23 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionFirstChar :: LineTerminator is incorrect"
es5id: 7.8.5_A1.3_T1
description: Line Feed, without eval
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
The first character of a regular expression may not be a <LF> (\u000A)
negative:
phase: early
type: SyntaxError
@ -12,6 +26,5 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
/
/

View File

@ -2,15 +2,29 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionFirstChar :: LineTerminator is incorrect"
es5id: 7.8.5_A1.3_T2
description: Line Feed, with eval
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
The first character of a regular expression may not be a <LF> (\u000A), evaluated
---*/
//CHECK#1
try {
eval("/\u000A/").source;
$ERROR('#1.1: RegularExpressionFirstChar :: Line Feed is incorrect. Actual: ' + (eval("/\u000A/").source));
$ERROR('#1.1: RegularExpressionFirstChar :: Line Feed is incorrect. Actual: ' + (eval("/\u000A/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,9 +2,23 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionFirstChar :: LineTerminator is incorrect"
es5id: 7.8.5_A1.3_T3
description: Carriage Return, without eval
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
The first character of a regular expression may not be a <CR>, (\u000D)
negative:
phase: early
type: SyntaxError
@ -12,6 +26,5 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
/
/

View File

@ -2,15 +2,29 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionFirstChar :: LineTerminator is incorrect"
es5id: 7.8.5_A1.3_T4
description: Carriage Return, with eval
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
The first character of a regular expression may not be a <CR>, (\u000D), evaluated
---*/
//CHECK#1
try {
eval("/\u000D/").source;
$ERROR('#1.1: RegularExpressionFirstChar :: Carriage Return is incorrect. Actual: ' + (eval("/\u000D/").source));
$ERROR('#1.1: RegularExpressionFirstChar :: Carriage Return is incorrect. Actual: ' + (eval("/\u000D/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,15 +2,30 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionFirstChar :: LineTerminator is incorrect"
es5id: 7.8.5_A1.3_T5
description: Line separator, with eval
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
The first character of a regular expression may not be a <LS>, (\u2028), evaluated
---*/
//CHECK#1
try {
eval("/\u2028/").source;
$ERROR('#1.1: RegularExpressionFirstChar :: Line separator is incorrect. Actual: ' + (eval("/\u2028/").source));
$ERROR('#1.1: RegularExpressionFirstChar :: Line separator is incorrect. Actual: ' + (eval("/\u2028/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,15 +2,29 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionFirstChar :: LineTerminator is incorrect"
es5id: 7.8.5_A1.3_T6
description: Paragraph separator, with eval
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
The first character of a regular expression may not be a <LS>, (\u2028), evaluated
---*/
//CHECK#1
try {
eval("/\u2029/").source;
$ERROR('#1.1: RegularExpressionFirstChar :: Paragraph separator is incorrect. Actual: ' + (eval("/\u2029/").source));
$ERROR('#1.1: RegularExpressionFirstChar :: Paragraph separator is incorrect. Actual: ' + (eval("/\u2029/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,11 +2,17 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
RegularExpressionFirstChar :: BackslashSequence :: \LineTerminator is
incorrect
es5id: 7.8.5_A1.5_T1
description: Line Feed, without eval
esid: prod-RegularExpressionBackslashSequence
info: |
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
A RegularExpressionBackslashSequence may not contain a <LF>
negative:
phase: early
type: SyntaxError
@ -14,6 +20,5 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
/\
/

View File

@ -2,17 +2,23 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
RegularExpressionFirstChar :: BackslashSequence :: \LineTerminator is
incorrect
es5id: 7.8.5_A1.5_T2
description: Line Feed, with eval
esid: prod-RegularExpressionBackslashSequence
info: |
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
A RegularExpressionBackslashSequence may not contain a <LF>, evaluated
---*/
//CHECK#1
try {
eval("/\\\u000A/").source;
$ERROR('#1.1: RegularExpressionFirstChar :: BackslashSequence :: \\Line Feed is incorrect. Actual: ' + (eval("/\\\u000A/").source));
try {
eval("/\\\u000A/").source;
$ERROR('#1.1: RegularExpressionFirstChar :: BackslashSequence :: \\Line Feed is incorrect. Actual: ' + (eval("/\\\u000A/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,11 +2,16 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
RegularExpressionFirstChar :: BackslashSequence :: \LineTerminator is
incorrect
es5id: 7.8.5_A1.5_T3
description: Carriage Return, without eval
esid: prod-RegularExpressionBackslashSequence
info: |
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
A RegularExpressionBackslashSequence may not contain a <CR>
negative:
phase: early
type: SyntaxError
@ -14,6 +19,5 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
/\
/

View File

@ -2,17 +2,22 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
RegularExpressionFirstChar :: BackslashSequence :: \LineTerminator is
incorrect
es5id: 7.8.5_A1.5_T4
description: Carriage Return, with eval
esid: prod-RegularExpressionBackslashSequence
info: |
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
A RegularExpressionBackslashSequence may not contain a <CR>, evaluated
---*/
//CHECK#1
try {
eval("/\\\u000D/").source;
$ERROR('#1.1: RegularExpressionFirstChar :: BackslashSequence :: \\Carriage Return is incorrect. Actual: ' + (eval("/\\\u000D/").source));
$ERROR('#1.1: RegularExpressionFirstChar :: BackslashSequence :: \\Carriage Return is incorrect. Actual: ' + (eval("/\\\u000D/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,17 +2,29 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
RegularExpressionFirstChar :: BackslashSequence :: \LineTerminator is
incorrect
es5id: 7.8.5_A1.5_T5
description: Line separator, with eval
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
The first character of a regular expression may not be a <LS>, (\u2028), evaluated
---*/
//CHECK#1
try {
eval("/\\\u2028/").source;
$ERROR('#1.1: RegularExpressionFirstChar :: BackslashSequence :: \\Line separator is incorrect. Actual: ' + (eval("/\\\u2028/").source));
$ERROR('#1.1: RegularExpressionFirstChar :: BackslashSequence :: \\Line separator is incorrect. Actual: ' + (eval("/\\\u2028/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,17 +2,29 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: >
RegularExpressionFirstChar :: BackslashSequence :: \LineTerminator is
incorrect
es5id: 7.8.5_A1.5_T6
description: Paragraph separator, with eval
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
The first character of a regular expression may not be a <PS>, (\u2029), evaluated
---*/
//CHECK#1
try {
eval("/\\\u2029/").source;
$ERROR('#1.1: RegularExpressionFirstChar :: BackslashSequence :: \\Paragraph separator is incorrect. Actual: ' + (eval("/\\\u2029/").source));
$ERROR('#1.1: RegularExpressionFirstChar :: BackslashSequence :: \\Paragraph separator is incorrect. Actual: ' + (eval("/\\\u2029/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,9 +2,17 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: \\ or / is incorrect"
es5id: 7.8.5_A2.2_T1
description: \
esid: prod-RegularExpressionChar
info: |
RegularExpressionChar ::
RegularExpressionNonTerminator but not one of \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
A regular express may not contain a "\" as a SourceCharacter
negative:
phase: early
type: SyntaxError
@ -12,5 +20,4 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
/a\/

View File

@ -2,9 +2,17 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: \\ or / is incorrect"
es5id: 7.8.5_A2.2_T2
description: /
esid: prod-RegularExpressionChar
info: |
RegularExpressionChar ::
RegularExpressionNonTerminator but not one of \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
A regular expression may not contain a "/" as a SourceCharacter
negative:
phase: early
type: SyntaxError
@ -12,5 +20,4 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
/a//.source;

View File

@ -2,9 +2,26 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: LineTerminator is incorrect"
es5id: 7.8.5_A2.3_T1
description: Line Feed, without eval
esid: sec-literals-regular-expression-literals
info: |
RegularExpressionChar ::
RegularExpressionBackslashSequence
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
LineTerminator ::
<LF>
<CR>
<LS>
<PS>
description: >
A regular expression may not contain a <LF> as a SourceCharacter
negative:
phase: early
type: SyntaxError
@ -12,6 +29,5 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
/a
/

View File

@ -2,15 +2,32 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: LineTerminator is incorrect"
es5id: 7.8.5_A2.3_T2
description: Line Feed, with eval
esid: sec-literals-regular-expression-literals
info: |
RegularExpressionChar ::
RegularExpressionBackslashSequence
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
LineTerminator ::
<LF>
<CR>
<LS>
<PS>
description: >
A regular expression may not contain a <LF> as a SourceCharacter, evaluated
---*/
//CHECK#1
try {
eval("/a\u000A/").source;
$ERROR('#1.1: RegularExpressionChar :: Line Feedis incorrect. Actual: ' + (eval("/a\u000A/").source));
$ERROR('#1.1: RegularExpressionChar :: Line Feedis incorrect. Actual: ' + (eval("/a\u000A/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,9 +2,27 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: LineTerminator is incorrect"
es5id: 7.8.5_A2.3_T3
description: Carriage Return, without eval
esid: sec-literals-regular-expression-literals
info: |
RegularExpressionChar ::
RegularExpressionBackslashSequence
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
LineTerminator ::
<LF>
<CR>
<LS>
<PS>
description: >
A regular expression may not contain a <CR> as a SourceCharacter
negative:
phase: early
type: SyntaxError
@ -12,6 +30,5 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
/a
/

View File

@ -2,15 +2,32 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: LineTerminator is incorrect"
es5id: 7.8.5_A2.3_T4
description: Carriage Return, with eval
esid: sec-literals-regular-expression-literals
info: |
RegularExpressionChar ::
RegularExpressionBackslashSequence
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
LineTerminator ::
<LF>
<CR>
<LS>
<PS>
description: >
A regular expression may not contain a <CR> as a SourceCharacter, evaluated
---*/
//CHECK#1
try {
eval("/a\u000D/").source;
$ERROR('#1.1: RegularExpressionChar :: Carriage Retur is incorrect. Actual: ' + (eval("/a\u000D/").source));
$ERROR('#1.1: RegularExpressionChar :: Carriage Retur is incorrect. Actual: ' + (eval("/a\u000D/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,15 +2,30 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: LineTerminator is incorrect"
es5id: 7.8.5_A2.3_T5
description: Line separator, with eval
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
A regular expression may not contain a <LS> as a SourceCharacter, evaluated
---*/
//CHECK#1
try {
eval("/a\u2028/").source;
$ERROR('#1.1: RegularExpressionChar :: Line separator is incorrect. Actual: ' + (eval("/a\u2028/").source));
$ERROR('#1.1: RegularExpressionChar :: Line separator is incorrect. Actual: ' + (eval("/a\u2028/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,15 +2,29 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: LineTerminator is incorrect"
es5id: 7.8.5_A2.3_T6
description: Paragraph separator, with eval
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
A regular expression may not contain a <PS> as a SourceCharacter, evaluated
---*/
//CHECK#1
try {
eval("/s\u2029/").source;
$ERROR('#1.1: RegularExpressionChar :: Paragraph separator is incorrect. Actual: ' + (eval("/s\u2029/").source));
$ERROR('#1.1: RegularExpressionChar :: Paragraph separator is incorrect. Actual: ' + (eval("/s\u2029/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,9 +2,22 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: BackslashSequence :: \\LineTerminator is incorrect"
es5id: 7.8.5_A2.5_T1
description: Line Feed, without eval
esid: prod-RegularExpressionBackslashSequence
info: |
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
LineTerminator ::
<LF>
<CR>
<LS>
<PS>
description: >
A regular expression may not contain a <LF> as a SourceCharacter
negative:
phase: early
type: SyntaxError
@ -12,6 +25,5 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
/a\
/

View File

@ -2,15 +2,28 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: BackslashSequence :: \\LineTerminator is incorrect"
es5id: 7.8.5_A2.5_T2
description: Line Feed, with eval
esid: prod-RegularExpressionBackslashSequence
info: |
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
LineTerminator ::
<LF>
<CR>
<LS>
<PS>
description: >
A regular expression may not contain a <LF> as a SourceCharacter, evaluated
---*/
//CHECK#1
try {
try {
eval("/a\\\u000A/").source;
$ERROR('#1.1: RegularExpressionChar :: BackslashSequence :: \\Line Feed is incorrect. Actual: ' + (eval("/a\\\u000A/").source));
$ERROR('#1.1: RegularExpressionChar :: BackslashSequence :: \\Line Feed is incorrect. Actual: ' + (eval("/a\\\u000A/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,9 +2,22 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: BackslashSequence :: \\LineTerminator is incorrect"
es5id: 7.8.5_A2.5_T3
description: Carriage Return, without eval
esid: prod-RegularExpressionBackslashSequence
info: |
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
LineTerminator ::
<LF>
<CR>
<LS>
<PS>
description: >
A regular expression may not contain a <CR> as a SourceCharacter
negative:
phase: early
type: SyntaxError
@ -12,6 +25,5 @@ negative:
throw "Test262: This statement should not be evaluated.";
//CHECK#1
/a\
/

View File

@ -2,15 +2,28 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: BackslashSequence :: \\LineTerminator is incorrect"
es5id: 7.8.5_A2.5_T4
description: Carriage Return, with eval
esid: prod-RegularExpressionBackslashSequence
info: |
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
LineTerminator ::
<LF>
<CR>
<LS>
<PS>
description: >
A regular expression may not contain a <LF> as a SourceCharacter, evaluated
---*/
//CHECK#1
try {
eval("/a\\\u000D/").source;
$ERROR('#1.1: RegularExpressionChar :: BackslashSequence :: \\Carriage Return is incorrect. Actual: ' + (eval("/a\\\u000D/").source));
$ERROR('#1.1: RegularExpressionChar :: BackslashSequence :: \\Carriage Return is incorrect. Actual: ' + (eval("/a\\\u000D/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,15 +2,28 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: BackslashSequence :: \\LineTerminator is incorrect"
es5id: 7.8.5_A2.5_T5
description: Line separator, with eval
esid: prod-RegularExpressionBackslashSequence
info: |
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
LineTerminator ::
<LF>
<CR>
<LS>
<PS>
description: >
A regular expression may not contain a <LS> as a SourceCharacter, evaluated
---*/
//CHECK#1
try {
eval("/a\\\u2028/").source;
$ERROR('#1.1: RegularExpressionChar :: BackslashSequence :: \\Line separator is incorrect. Actual: ' + (eval("/a\\\u2028/").source));
$ERROR('#1.1: RegularExpressionChar :: BackslashSequence :: \\Line separator is incorrect. Actual: ' + (eval("/a\\\u2028/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -2,15 +2,28 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: "RegularExpressionChar :: BackslashSequence :: \\LineTerminator is incorrect"
es5id: 7.8.5_A2.5_T6
description: Paragraph separator, with eval
esid: prod-RegularExpressionBackslashSequence
info: |
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
LineTerminator ::
<LF>
<CR>
<LS>
<PS>
description: >
A regular expression may not contain a <PS> as a SourceCharacter, evaluated
---*/
//CHECK#1
try {
eval("/a\\\u2029/").source;
$ERROR('#1.1: RegularExpressionChar :: BackslashSequence :: \\Paragraph separator is incorrect. Actual: ' + (eval("/a\\\u2029/").source));
$ERROR('#1.1: RegularExpressionChar :: BackslashSequence :: \\Paragraph separator is incorrect. Actual: ' + (eval("/a\\\u2029/").source));
}
catch (e) {
if ((e instanceof SyntaxError) !== true) {

View File

@ -10,9 +10,10 @@ es5id: 7.8.5_A4.2
description: Check equality two regular expression literals
---*/
//CHECK#1
var regexp1 = /(?:)/;
var regexp2 = /(?:)/;
if (regexp1 === regexp2) {
$ERROR('#1: var regexp1 = /(?:)/; var regexp2 = /(?:)/; regexp1 !== regexp2');
}
assert.notSameValue(
regexp1,
regexp2,
"var regexp1 = /(?:)/; var regexp2 = /(?:)/; regexp1 !== regexp2"
);

View File

@ -1,12 +1,13 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Literal may not contain an unrecognized flag (early error)
esid: sec-primary-expression-regular-expression-literals-static-semantics-early-errors
info: >
It is a Syntax Error if FlagText of RegularExpressionLiteral contains any
code points other than "g", "i", "m", "u", or "y", or if it contains the
same code point more than once.
info: |
PrimaryExpression : RegularExpressionLiteral
description: >
It is a Syntax Error if FlagText of RegularExpressionLiteral contains any code points other than "g", "i", "m", "u", or "y", ...
negative:
phase: early
type: SyntaxError
@ -14,6 +15,4 @@ negative:
throw "Test262: This statement should not be evaluated.";
throw new Test262Error();
/./G;

View File

@ -1,12 +1,13 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Literal may not contain duplicate flags (early error)
esid: sec-primary-expression-regular-expression-literals-static-semantics-early-errors
info: >
It is a Syntax Error if FlagText of RegularExpressionLiteral contains any
code points other than "g", "i", "m", "u", or "y", or if it contains the
same code point more than once.
info: |
PrimaryExpression : RegularExpressionLiteral
description: >
It is a Syntax Error if FlagText of RegularExpressionLiteral contains ... the same code point more than once.
negative:
phase: early
type: SyntaxError
@ -14,6 +15,4 @@ negative:
throw "Test262: This statement should not be evaluated.";
throw new Test262Error();
/./gig;

View File

@ -2,11 +2,12 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-literals-regular-expression-literals-static-semantics-early-errors
es6id: 11.8.5.1
description: >
RegularExpressionFlags :: RegularExpressionFlags IdentifierPart
info: |
RegularExpressionFlags ::
RegularExpressionFlags IdentifierPart
- It is a Syntax Error if IdentifierPart contains a Unicode escape sequence.
description: >
It is a Syntax Error if IdentifierPart contains a Unicode escape sequence.
negative:
phase: early
type: SyntaxError

View File

@ -1,12 +1,12 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Literal may not describe an invalid pattern (early error)
esid: sec-primary-expression-regular-expression-literals-static-semantics-early-errors
info: >
It is a Syntax Error if BodyText of RegularExpressionLiteral cannot be
recognized using the goal symbol Pattern of the ECMAScript RegExp grammar
specified in 21.2.1.
info: |
PrimaryExpression : RegularExpressionLiteral
description: >
It is a Syntax Error if BodyText of RegularExpressionLiteral cannot be recognized using the goal symbol Pattern of the ECMAScript RegExp grammar specified in #sec-patterns.
negative:
phase: early
type: SyntaxError
@ -14,6 +14,4 @@ negative:
throw "Test262: This statement should not be evaluated.";
throw new Test262Error();
/?/;

View File

@ -9,7 +9,7 @@ info: |
^$\.*+?()[]{}|
PatternCharacter ::
SourceCharacterbut not SyntaxCharacter
SourceCharacter but not SyntaxCharacter
Although Annex B extends the definition of Term to include
ExtendedPatternCharacter, it also introduces the InvalidBracedQuantifier

View File

@ -9,7 +9,7 @@ info: |
^$\.*+?()[]{}|
PatternCharacter ::
SourceCharacterbut not SyntaxCharacter
SourceCharacter but not SyntaxCharacter
Although Annex B extends the definition of Term to include
ExtendedPatternCharacter, it also introduces the InvalidBracedQuantifier

View File

@ -9,7 +9,7 @@ info: |
^$\.*+?()[]{}|
PatternCharacter ::
SourceCharacterbut not SyntaxCharacter
SourceCharacter but not SyntaxCharacter
Although Annex B extends the definition of Term to include
ExtendedPatternCharacter, it also introduces the InvalidBracedQuantifier

View File

@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-regular-expression-literals-runtime-semantics-evaluation
es6id: 12.2.8.2
description: Initial state of the `lastIndex` property
info: |
[...]
@ -11,7 +10,7 @@ info: |
21.2.3.2.3 Runtime Semantics: RegExpCreate
1. Let obj be ? RegExpAlloc(%RegExp%).
2. Return ? RegExpInitialize(obj, P, F).
2. Return ? RegExpInitialize(obj, P, F).
21.2.3.2.2 Runtime Semantics: RegExpInitialize

View File

@ -0,0 +1,33 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
The first character of a regular expression may not be a <LS>
negative:
phase: early
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
//
/*
There is a <LS> between the two / characters
*/

View File

@ -0,0 +1,33 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
The first character of a regular expression may not be a <PS>
negative:
phase: early
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
//
/*
There is a <PS> between the two / characters
*/

View File

@ -0,0 +1,32 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: prod-RegularExpressionBackslashSequence
info: |
RegularExpressionBackslashSequence ::
\ RegularExpressionNonTerminator
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
LineTerminator ::
<LF>
<CR>
<LS>
<PS>
description: >
A regular expression may not contain a <LS> as a SourceCharacter
negative:
phase: early
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
/a\\/
/*
There is a <LS> between "a\\" and "/"
*/

View File

@ -0,0 +1,33 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: prod-RegularExpressionNonTerminator
info: |
RegularExpressionBody ::
RegularExpressionFirstChar RegularExpressionChars
RegularExpressionChars ::
[empty]
RegularExpressionChars RegularExpressionChar
RegularExpressionFirstChar ::
RegularExpressionNonTerminator but not one of * or \ or / or [
RegularExpressionNonTerminator ::
SourceCharacter but not LineTerminator
description: >
A regular expression may not contain a <PS> as a SourceCharacter
negative:
phase: early
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
/a\\/
/*
There is a <PS> between "a\\" and "/"
*/