Skip to content
Snippets Groups Projects
Commit 0ec9dbe3 authored by Mike Pennisi's avatar Mike Pennisi
Browse files

Refactor LT tests for parsers: single-line comment

The tests for the parsing of line terminators were expressed using eval.
This made the tests more complex than necessary and also prevented the
tests from providing value to ECMAScript parsers.

Remove the use of eval and instead express the expectations with literal
source text. Rename the files to make each test's purpose more clear.
parent f9ffa71c
No related branches found
No related tags found
No related merge requests found
...@@ -3,16 +3,20 @@ ...@@ -3,16 +3,20 @@
/*--- /*---
info: Single line comments can contain Line Terminator at the end of line info: Single line comments can contain Line Terminator at the end of line
esid: sec-line-terminators
es5id: 7.3_A4_T2 es5id: 7.3_A4_T2
description: Insert CARRIAGE RETURN (U+000D) into the end of single line comment description: Insert CARRIAGE RETURN (U+000D) into the end of single line comment
negative:
phase: runtime
type: Test262Error
---*/ ---*/
// CHECK#1 // Because this test concerns the interpretation of non-executable character
eval("// single line comment\u000D"); // sequences within ECMAScript source code, special care must be taken to
// ensure that executable code is evaluated as expected.
//
// Express the intended behavior by intentionally throwing an error; this
// guarantees that test runners will only consider the test "passing" if
// executable sequences are correctly interpreted as such.
// CHECK#2 // single line throw new Test262Error();
var x = 0;
eval("// single line comment\u000D x = 1;");
if (x !== 1) {
$ERROR('#1: var x = 0; eval("// single line comment\\u000D x = 1;"); x === 1. Actual: ' + (x));
}
......
...@@ -3,10 +3,21 @@ ...@@ -3,10 +3,21 @@
/*--- /*---
info: Single line comments are terminated by the LINE FEED (U+000A) character info: Single line comments are terminated by the LINE FEED (U+000A) character
esid: sec-line-terminators
es5id: 7.3_A3.1_T1 es5id: 7.3_A3.1_T1
description: Insert LINE FEED (\u000A) into single line comment description: Insert LINE FEED (\u000A) into single line comment
negative:
phase: runtime
type: Test262Error
---*/ ---*/
assert.throws(Test262Error, function() { // Because this test concerns the interpretation of non-executable character
eval("// single line \u000A throw new Test262Error();"); // sequences within ECMAScript source code, special care must be taken to
}); // ensure that executable code is evaluated as expected.
//
// Express the intended behavior by intentionally throwing an error; this
// guarantees that test runners will only consider the test "passing" if
// executable sequences are correctly interpreted as such.
// single line
throw new Test262Error();
...@@ -3,16 +3,20 @@ ...@@ -3,16 +3,20 @@
/*--- /*---
info: Single line comments can contain Line Terminator at the end of line info: Single line comments can contain Line Terminator at the end of line
esid: sec-line-terminators
es5id: 7.3_A4_T3 es5id: 7.3_A4_T3
description: Insert LINE SEPARATOR (U+2028) into the end of single line comment description: Insert LINE SEPARATOR (U+2028) into the end of single line comment
negative:
phase: runtime
type: Test262Error
---*/ ---*/
// CHECK#1 // Because this test concerns the interpretation of non-executable character
eval("// single line comment\u2028"); // sequences within ECMAScript source code, special care must be taken to
// ensure that executable code is evaluated as expected.
//
// Express the intended behavior by intentionally throwing an error; this
// guarantees that test runners will only consider the test "passing" if
// executable sequences are correctly interpreted as such.
// CHECK#2 // single line
throw new Test262Error();
var x = 0;
eval("// single line comment\u2028 x = 1;");
if (x !== 1) {
$ERROR('#1: var x = 0; eval("// single line comment\\u2028 x = 1;"); x === 1. Actual: ' + (x));
}
...@@ -3,18 +3,22 @@ ...@@ -3,18 +3,22 @@
/*--- /*---
info: Single line comments can contain Line Terminator at the end of line info: Single line comments can contain Line Terminator at the end of line
esid: sec-line-terminators
es5id: 7.3_A4_T4 es5id: 7.3_A4_T4
description: > description: >
Insert PARAGRAPH SEPARATOR (U+2029) into the end of single line Insert PARAGRAPH SEPARATOR (U+2029) into the end of single line
comment comment
negative:
phase: runtime
type: Test262Error
---*/ ---*/
// CHECK#1 // Because this test concerns the interpretation of non-executable character
eval("// single line comment\u2029"); // sequences within ECMAScript source code, special care must be taken to
// ensure that executable code is evaluated as expected.
//
// Express the intended behavior by intentionally throwing an error; this
// guarantees that test runners will only consider the test "passing" if
// executable sequences are correctly interpreted as such.
// CHECK#2 // single line
throw new Test262Error();
var x = 0;
eval("// single line comment\u2029 x = 1;");
if (x !== 1) {
$ERROR('#1: var x = 0; eval("// single line comment\\u2029 x = 1;"); x === 1. Actual: ' + (x));
}
...@@ -4,9 +4,13 @@ ...@@ -4,9 +4,13 @@
/*--- /*---
info: Single line comments can not contain CARRIAGE RETURN (U+000D) inside info: Single line comments can not contain CARRIAGE RETURN (U+000D) inside
es5id: 7.3_A3.2_T2 es5id: 7.3_A3.2_T2
esid: sec-line-terminators
description: Insert CARRIAGE RETURN (\u000D) into begin of single line comment description: Insert CARRIAGE RETURN (\u000D) into begin of single line comment
negative:
phase: parse
type: SyntaxError
---*/ ---*/
assert.throws(SyntaxError, function() { $DONOTEVALUATE();
eval("//\u000D single line comment");
}); // this text is not included in the single-line comment that precedes it
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment