From 5d4c667b271a9b39d0de73aef5ffe6879c6f8811 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Mon, 16 Oct 2017 12:46:28 -0400 Subject: [PATCH] test/language/literals/regexp/*: early error test fixups (#1276) --- test/language/literals/regexp/7.8.5-1.js | 26 ++++++++++---- test/language/literals/regexp/7.8.5-1gs.js | 35 +++++++++++++++---- .../literals/regexp/S7.8.5_A1.1_T1.js | 4 +-- .../literals/regexp/S7.8.5_A1.2_T1.js | 15 +++++--- .../literals/regexp/S7.8.5_A1.2_T2.js | 18 +++++++--- .../literals/regexp/S7.8.5_A1.2_T3.js | 18 +++++++--- .../literals/regexp/S7.8.5_A1.2_T4.js | 18 +++++++--- .../literals/regexp/S7.8.5_A1.3_T1.js | 21 ++++++++--- .../literals/regexp/S7.8.5_A1.3_T2.js | 22 +++++++++--- .../literals/regexp/S7.8.5_A1.3_T3.js | 21 ++++++++--- .../literals/regexp/S7.8.5_A1.3_T4.js | 22 +++++++++--- .../literals/regexp/S7.8.5_A1.3_T5.js | 23 +++++++++--- .../literals/regexp/S7.8.5_A1.3_T6.js | 22 +++++++++--- .../literals/regexp/S7.8.5_A1.5_T1.js | 17 +++++---- .../literals/regexp/S7.8.5_A1.5_T2.js | 22 +++++++----- .../literals/regexp/S7.8.5_A1.5_T3.js | 16 +++++---- .../literals/regexp/S7.8.5_A1.5_T4.js | 17 +++++---- .../literals/regexp/S7.8.5_A1.5_T5.js | 24 +++++++++---- .../literals/regexp/S7.8.5_A1.5_T6.js | 24 +++++++++---- .../literals/regexp/S7.8.5_A2.2_T1.js | 15 +++++--- .../literals/regexp/S7.8.5_A2.2_T2.js | 15 +++++--- .../literals/regexp/S7.8.5_A2.3_T1.js | 24 ++++++++++--- .../literals/regexp/S7.8.5_A2.3_T2.js | 25 ++++++++++--- .../literals/regexp/S7.8.5_A2.3_T3.js | 25 ++++++++++--- .../literals/regexp/S7.8.5_A2.3_T4.js | 25 ++++++++++--- .../literals/regexp/S7.8.5_A2.3_T5.js | 23 +++++++++--- .../literals/regexp/S7.8.5_A2.3_T6.js | 24 ++++++++++--- .../literals/regexp/S7.8.5_A2.5_T1.js | 20 ++++++++--- .../literals/regexp/S7.8.5_A2.5_T2.js | 23 +++++++++--- .../literals/regexp/S7.8.5_A2.5_T3.js | 20 ++++++++--- .../literals/regexp/S7.8.5_A2.5_T4.js | 21 ++++++++--- .../literals/regexp/S7.8.5_A2.5_T5.js | 21 ++++++++--- .../literals/regexp/S7.8.5_A2.5_T6.js | 21 ++++++++--- test/language/literals/regexp/S7.8.5_A4.2.js | 9 ++--- .../literals/regexp/early-err-bad-flag.js | 13 ++++--- .../literals/regexp/early-err-dup-flag.js | 13 ++++--- .../regexp/early-err-flags-unicode-escape.js | 9 ++--- .../literals/regexp/early-err-pattern.js | 12 +++---- .../regexp/invalid-braced-quantifier-exact.js | 2 +- .../regexp/invalid-braced-quantifier-lower.js | 2 +- .../regexp/invalid-braced-quantifier-range.js | 2 +- test/language/literals/regexp/lastIndex.js | 3 +- .../regexp-first-char-no-line-separator.js | 33 +++++++++++++++++ ...egexp-first-char-no-paragraph-separator.js | 33 +++++++++++++++++ .../regexp-source-char-no-line-separator.js | 32 +++++++++++++++++ ...gexp-source-char-no-paragraph-separator.js | 33 +++++++++++++++++ 46 files changed, 698 insertions(+), 185 deletions(-) create mode 100644 test/language/literals/regexp/regexp-first-char-no-line-separator.js create mode 100644 test/language/literals/regexp/regexp-first-char-no-paragraph-separator.js create mode 100644 test/language/literals/regexp/regexp-source-char-no-line-separator.js create mode 100644 test/language/literals/regexp/regexp-source-char-no-paragraph-separator.js diff --git a/test/language/literals/regexp/7.8.5-1.js b/test/language/literals/regexp/7.8.5-1.js index 5e37755d82..4b76d6adfc 100644 --- a/test/language/literals/regexp/7.8.5-1.js +++ b/test/language/literals/regexp/7.8.5-1.js @@ -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/;" + +*/ }); diff --git a/test/language/literals/regexp/7.8.5-1gs.js b/test/language/literals/regexp/7.8.5-1gs.js index 6b8c81a51d..345042142a 100644 --- a/test/language/literals/regexp/7.8.5-1gs.js +++ b/test/language/literals/regexp/7.8.5-1gs.js @@ -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 = //; diff --git a/test/language/literals/regexp/S7.8.5_A1.1_T1.js b/test/language/literals/regexp/S7.8.5_A1.1_T1.js index f0f4f0112b..0440a20abe 100644 --- a/test/language/literals/regexp/S7.8.5_A1.1_T1.js +++ b/test/language/literals/regexp/S7.8.5_A1.1_T1.js @@ -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") { diff --git a/test/language/literals/regexp/S7.8.5_A1.2_T1.js b/test/language/literals/regexp/S7.8.5_A1.2_T1.js index 9d1783ae67..b40a2e5b42 100644 --- a/test/language/literals/regexp/S7.8.5_A1.2_T1.js +++ b/test/language/literals/regexp/S7.8.5_A1.2_T1.js @@ -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 /*/ diff --git a/test/language/literals/regexp/S7.8.5_A1.2_T2.js b/test/language/literals/regexp/S7.8.5_A1.2_T2.js index dd9950451f..ad35ebc04f 100644 --- a/test/language/literals/regexp/S7.8.5_A1.2_T2.js +++ b/test/language/literals/regexp/S7.8.5_A1.2_T2.js @@ -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 /\/ diff --git a/test/language/literals/regexp/S7.8.5_A1.2_T3.js b/test/language/literals/regexp/S7.8.5_A1.2_T3.js index 579f29474f..3c954dca80 100644 --- a/test/language/literals/regexp/S7.8.5_A1.2_T3.js +++ b/test/language/literals/regexp/S7.8.5_A1.2_T3.js @@ -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; diff --git a/test/language/literals/regexp/S7.8.5_A1.2_T4.js b/test/language/literals/regexp/S7.8.5_A1.2_T4.js index 4d1bf624af..dfafc38bf3 100644 --- a/test/language/literals/regexp/S7.8.5_A1.2_T4.js +++ b/test/language/literals/regexp/S7.8.5_A1.2_T4.js @@ -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; diff --git a/test/language/literals/regexp/S7.8.5_A1.3_T1.js b/test/language/literals/regexp/S7.8.5_A1.3_T1.js index 001dac3a92..6659d52d12 100644 --- a/test/language/literals/regexp/S7.8.5_A1.3_T1.js +++ b/test/language/literals/regexp/S7.8.5_A1.3_T1.js @@ -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 (\u000A) negative: phase: early type: SyntaxError @@ -12,6 +26,5 @@ negative: throw "Test262: This statement should not be evaluated."; -//CHECK#1 / / diff --git a/test/language/literals/regexp/S7.8.5_A1.3_T2.js b/test/language/literals/regexp/S7.8.5_A1.3_T2.js index 0a0a459c9a..fbe1925113 100644 --- a/test/language/literals/regexp/S7.8.5_A1.3_T2.js +++ b/test/language/literals/regexp/S7.8.5_A1.3_T2.js @@ -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 (\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) { diff --git a/test/language/literals/regexp/S7.8.5_A1.3_T3.js b/test/language/literals/regexp/S7.8.5_A1.3_T3.js index 49cc7a580d..476cb30063 100644 --- a/test/language/literals/regexp/S7.8.5_A1.3_T3.js +++ b/test/language/literals/regexp/S7.8.5_A1.3_T3.js @@ -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 , (\u000D) negative: phase: early type: SyntaxError @@ -12,6 +26,5 @@ negative: throw "Test262: This statement should not be evaluated."; -//CHECK#1 / / diff --git a/test/language/literals/regexp/S7.8.5_A1.3_T4.js b/test/language/literals/regexp/S7.8.5_A1.3_T4.js index 5f0e456b67..588da09565 100644 --- a/test/language/literals/regexp/S7.8.5_A1.3_T4.js +++ b/test/language/literals/regexp/S7.8.5_A1.3_T4.js @@ -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 , (\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) { diff --git a/test/language/literals/regexp/S7.8.5_A1.3_T5.js b/test/language/literals/regexp/S7.8.5_A1.3_T5.js index a18ac77784..b157c4b8f6 100644 --- a/test/language/literals/regexp/S7.8.5_A1.3_T5.js +++ b/test/language/literals/regexp/S7.8.5_A1.3_T5.js @@ -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 , (\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) { diff --git a/test/language/literals/regexp/S7.8.5_A1.3_T6.js b/test/language/literals/regexp/S7.8.5_A1.3_T6.js index 3acb6c2c3b..28e6cd99c4 100644 --- a/test/language/literals/regexp/S7.8.5_A1.3_T6.js +++ b/test/language/literals/regexp/S7.8.5_A1.3_T6.js @@ -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 , (\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) { diff --git a/test/language/literals/regexp/S7.8.5_A1.5_T1.js b/test/language/literals/regexp/S7.8.5_A1.5_T1.js index ac338c327d..8b647a7aff 100644 --- a/test/language/literals/regexp/S7.8.5_A1.5_T1.js +++ b/test/language/literals/regexp/S7.8.5_A1.5_T1.js @@ -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 + negative: phase: early type: SyntaxError @@ -14,6 +20,5 @@ negative: throw "Test262: This statement should not be evaluated."; -//CHECK#1 /\ / diff --git a/test/language/literals/regexp/S7.8.5_A1.5_T2.js b/test/language/literals/regexp/S7.8.5_A1.5_T2.js index dbdbbd91fc..614932591a 100644 --- a/test/language/literals/regexp/S7.8.5_A1.5_T2.js +++ b/test/language/literals/regexp/S7.8.5_A1.5_T2.js @@ -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 , 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) { diff --git a/test/language/literals/regexp/S7.8.5_A1.5_T3.js b/test/language/literals/regexp/S7.8.5_A1.5_T3.js index 2aa50a7b0b..e8de90d4fb 100644 --- a/test/language/literals/regexp/S7.8.5_A1.5_T3.js +++ b/test/language/literals/regexp/S7.8.5_A1.5_T3.js @@ -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 negative: phase: early type: SyntaxError @@ -14,6 +19,5 @@ negative: throw "Test262: This statement should not be evaluated."; -//CHECK#1 /\ / diff --git a/test/language/literals/regexp/S7.8.5_A1.5_T4.js b/test/language/literals/regexp/S7.8.5_A1.5_T4.js index a5517a6b61..732fc3122c 100644 --- a/test/language/literals/regexp/S7.8.5_A1.5_T4.js +++ b/test/language/literals/regexp/S7.8.5_A1.5_T4.js @@ -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 , 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) { diff --git a/test/language/literals/regexp/S7.8.5_A1.5_T5.js b/test/language/literals/regexp/S7.8.5_A1.5_T5.js index d1d019c7af..1e6b59b722 100644 --- a/test/language/literals/regexp/S7.8.5_A1.5_T5.js +++ b/test/language/literals/regexp/S7.8.5_A1.5_T5.js @@ -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 , (\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) { diff --git a/test/language/literals/regexp/S7.8.5_A1.5_T6.js b/test/language/literals/regexp/S7.8.5_A1.5_T6.js index d1818bc6c5..0f448d3c81 100644 --- a/test/language/literals/regexp/S7.8.5_A1.5_T6.js +++ b/test/language/literals/regexp/S7.8.5_A1.5_T6.js @@ -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 , (\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) { diff --git a/test/language/literals/regexp/S7.8.5_A2.2_T1.js b/test/language/literals/regexp/S7.8.5_A2.2_T1.js index 85193f8503..1a07bd25d1 100644 --- a/test/language/literals/regexp/S7.8.5_A2.2_T1.js +++ b/test/language/literals/regexp/S7.8.5_A2.2_T1.js @@ -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\/ diff --git a/test/language/literals/regexp/S7.8.5_A2.2_T2.js b/test/language/literals/regexp/S7.8.5_A2.2_T2.js index 5cc1f2d3f8..5f550758bf 100644 --- a/test/language/literals/regexp/S7.8.5_A2.2_T2.js +++ b/test/language/literals/regexp/S7.8.5_A2.2_T2.js @@ -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; diff --git a/test/language/literals/regexp/S7.8.5_A2.3_T1.js b/test/language/literals/regexp/S7.8.5_A2.3_T1.js index 60acc3501f..9d7813f61c 100644 --- a/test/language/literals/regexp/S7.8.5_A2.3_T1.js +++ b/test/language/literals/regexp/S7.8.5_A2.3_T1.js @@ -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 :: + + + + + +description: > + A regular expression may not contain a as a SourceCharacter negative: phase: early type: SyntaxError @@ -12,6 +29,5 @@ negative: throw "Test262: This statement should not be evaluated."; -//CHECK#1 /a / diff --git a/test/language/literals/regexp/S7.8.5_A2.3_T2.js b/test/language/literals/regexp/S7.8.5_A2.3_T2.js index d6929c98be..67337b7b8d 100644 --- a/test/language/literals/regexp/S7.8.5_A2.3_T2.js +++ b/test/language/literals/regexp/S7.8.5_A2.3_T2.js @@ -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 :: + + + + + +description: > + A regular expression may not contain a 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) { diff --git a/test/language/literals/regexp/S7.8.5_A2.3_T3.js b/test/language/literals/regexp/S7.8.5_A2.3_T3.js index 149060d128..d0b0b62cdf 100644 --- a/test/language/literals/regexp/S7.8.5_A2.3_T3.js +++ b/test/language/literals/regexp/S7.8.5_A2.3_T3.js @@ -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 :: + + + + + +description: > + A regular expression may not contain a as a SourceCharacter + negative: phase: early type: SyntaxError @@ -12,6 +30,5 @@ negative: throw "Test262: This statement should not be evaluated."; -//CHECK#1 /a / diff --git a/test/language/literals/regexp/S7.8.5_A2.3_T4.js b/test/language/literals/regexp/S7.8.5_A2.3_T4.js index 1a1e0698bf..9224a5ebc2 100644 --- a/test/language/literals/regexp/S7.8.5_A2.3_T4.js +++ b/test/language/literals/regexp/S7.8.5_A2.3_T4.js @@ -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 :: + + + + + +description: > + A regular expression may not contain a 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) { diff --git a/test/language/literals/regexp/S7.8.5_A2.3_T5.js b/test/language/literals/regexp/S7.8.5_A2.3_T5.js index eda5ce5e22..25d434f0b9 100644 --- a/test/language/literals/regexp/S7.8.5_A2.3_T5.js +++ b/test/language/literals/regexp/S7.8.5_A2.3_T5.js @@ -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 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) { diff --git a/test/language/literals/regexp/S7.8.5_A2.3_T6.js b/test/language/literals/regexp/S7.8.5_A2.3_T6.js index f658cc5025..2d16024f0d 100644 --- a/test/language/literals/regexp/S7.8.5_A2.3_T6.js +++ b/test/language/literals/regexp/S7.8.5_A2.3_T6.js @@ -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 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) { diff --git a/test/language/literals/regexp/S7.8.5_A2.5_T1.js b/test/language/literals/regexp/S7.8.5_A2.5_T1.js index ee4852e975..5e778da601 100644 --- a/test/language/literals/regexp/S7.8.5_A2.5_T1.js +++ b/test/language/literals/regexp/S7.8.5_A2.5_T1.js @@ -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 :: + + + + + +description: > + A regular expression may not contain a as a SourceCharacter negative: phase: early type: SyntaxError @@ -12,6 +25,5 @@ negative: throw "Test262: This statement should not be evaluated."; -//CHECK#1 /a\ / diff --git a/test/language/literals/regexp/S7.8.5_A2.5_T2.js b/test/language/literals/regexp/S7.8.5_A2.5_T2.js index 6b459e34fe..d71bc308cf 100644 --- a/test/language/literals/regexp/S7.8.5_A2.5_T2.js +++ b/test/language/literals/regexp/S7.8.5_A2.5_T2.js @@ -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 :: + + + + + +description: > + A regular expression may not contain a 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) { diff --git a/test/language/literals/regexp/S7.8.5_A2.5_T3.js b/test/language/literals/regexp/S7.8.5_A2.5_T3.js index 1661bb809e..c141e14a51 100644 --- a/test/language/literals/regexp/S7.8.5_A2.5_T3.js +++ b/test/language/literals/regexp/S7.8.5_A2.5_T3.js @@ -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 :: + + + + + +description: > + A regular expression may not contain a as a SourceCharacter negative: phase: early type: SyntaxError @@ -12,6 +25,5 @@ negative: throw "Test262: This statement should not be evaluated."; -//CHECK#1 /a\ / diff --git a/test/language/literals/regexp/S7.8.5_A2.5_T4.js b/test/language/literals/regexp/S7.8.5_A2.5_T4.js index 18ba23b647..bc4312d79c 100644 --- a/test/language/literals/regexp/S7.8.5_A2.5_T4.js +++ b/test/language/literals/regexp/S7.8.5_A2.5_T4.js @@ -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 :: + + + + + +description: > + A regular expression may not contain a 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) { diff --git a/test/language/literals/regexp/S7.8.5_A2.5_T5.js b/test/language/literals/regexp/S7.8.5_A2.5_T5.js index 1e74d005f8..0b41aa4395 100644 --- a/test/language/literals/regexp/S7.8.5_A2.5_T5.js +++ b/test/language/literals/regexp/S7.8.5_A2.5_T5.js @@ -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 :: + + + + + +description: > + A regular expression may not contain a 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) { diff --git a/test/language/literals/regexp/S7.8.5_A2.5_T6.js b/test/language/literals/regexp/S7.8.5_A2.5_T6.js index 2ed5331429..7241b5fbcf 100644 --- a/test/language/literals/regexp/S7.8.5_A2.5_T6.js +++ b/test/language/literals/regexp/S7.8.5_A2.5_T6.js @@ -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 :: + + + + + +description: > + A regular expression may not contain a 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) { diff --git a/test/language/literals/regexp/S7.8.5_A4.2.js b/test/language/literals/regexp/S7.8.5_A4.2.js index c1ce2b4847..c98a66dd5a 100644 --- a/test/language/literals/regexp/S7.8.5_A4.2.js +++ b/test/language/literals/regexp/S7.8.5_A4.2.js @@ -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" +); diff --git a/test/language/literals/regexp/early-err-bad-flag.js b/test/language/literals/regexp/early-err-bad-flag.js index ab13fd4557..4cbd00c913 100644 --- a/test/language/literals/regexp/early-err-bad-flag.js +++ b/test/language/literals/regexp/early-err-bad-flag.js @@ -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; diff --git a/test/language/literals/regexp/early-err-dup-flag.js b/test/language/literals/regexp/early-err-dup-flag.js index 026371d649..a88a8c57e8 100644 --- a/test/language/literals/regexp/early-err-dup-flag.js +++ b/test/language/literals/regexp/early-err-dup-flag.js @@ -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; diff --git a/test/language/literals/regexp/early-err-flags-unicode-escape.js b/test/language/literals/regexp/early-err-flags-unicode-escape.js index 7f54f2fff0..2ccae26cb2 100644 --- a/test/language/literals/regexp/early-err-flags-unicode-escape.js +++ b/test/language/literals/regexp/early-err-flags-unicode-escape.js @@ -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 diff --git a/test/language/literals/regexp/early-err-pattern.js b/test/language/literals/regexp/early-err-pattern.js index d4da6f6c49..a846d7bb8d 100644 --- a/test/language/literals/regexp/early-err-pattern.js +++ b/test/language/literals/regexp/early-err-pattern.js @@ -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(); - /?/; diff --git a/test/language/literals/regexp/invalid-braced-quantifier-exact.js b/test/language/literals/regexp/invalid-braced-quantifier-exact.js index c7b6006957..1fc95c7f9f 100644 --- a/test/language/literals/regexp/invalid-braced-quantifier-exact.js +++ b/test/language/literals/regexp/invalid-braced-quantifier-exact.js @@ -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 diff --git a/test/language/literals/regexp/invalid-braced-quantifier-lower.js b/test/language/literals/regexp/invalid-braced-quantifier-lower.js index 3c9916e4f7..bb687bd06d 100644 --- a/test/language/literals/regexp/invalid-braced-quantifier-lower.js +++ b/test/language/literals/regexp/invalid-braced-quantifier-lower.js @@ -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 diff --git a/test/language/literals/regexp/invalid-braced-quantifier-range.js b/test/language/literals/regexp/invalid-braced-quantifier-range.js index c69b02a675..90148ea155 100644 --- a/test/language/literals/regexp/invalid-braced-quantifier-range.js +++ b/test/language/literals/regexp/invalid-braced-quantifier-range.js @@ -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 diff --git a/test/language/literals/regexp/lastIndex.js b/test/language/literals/regexp/lastIndex.js index 939438672f..f1aeb338c8 100644 --- a/test/language/literals/regexp/lastIndex.js +++ b/test/language/literals/regexp/lastIndex.js @@ -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 diff --git a/test/language/literals/regexp/regexp-first-char-no-line-separator.js b/test/language/literals/regexp/regexp-first-char-no-line-separator.js new file mode 100644 index 0000000000..67d1a9597d --- /dev/null +++ b/test/language/literals/regexp/regexp-first-char-no-line-separator.js @@ -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 +negative: + phase: early + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +/
/ + +/* +There is a between the two / characters +*/ diff --git a/test/language/literals/regexp/regexp-first-char-no-paragraph-separator.js b/test/language/literals/regexp/regexp-first-char-no-paragraph-separator.js new file mode 100644 index 0000000000..369a9cceaa --- /dev/null +++ b/test/language/literals/regexp/regexp-first-char-no-paragraph-separator.js @@ -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 +negative: + phase: early + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +/
/ + +/* +There is a between the two / characters +*/ diff --git a/test/language/literals/regexp/regexp-source-char-no-line-separator.js b/test/language/literals/regexp/regexp-source-char-no-line-separator.js new file mode 100644 index 0000000000..6567824339 --- /dev/null +++ b/test/language/literals/regexp/regexp-source-char-no-line-separator.js @@ -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 :: + + + + + +description: > + A regular expression may not contain a as a SourceCharacter +negative: + phase: early + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +/a\\
/ + +/* +There is a between "a\\
" and "/" +*/ diff --git a/test/language/literals/regexp/regexp-source-char-no-paragraph-separator.js b/test/language/literals/regexp/regexp-source-char-no-paragraph-separator.js new file mode 100644 index 0000000000..0c496e0278 --- /dev/null +++ b/test/language/literals/regexp/regexp-source-char-no-paragraph-separator.js @@ -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 as a SourceCharacter +negative: + phase: early + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +/a\\

/ + +/* +There is a between "a\\
" and "/" +*/