1
0
mirror of https://github.com/tc39/test262.git synced 2025-04-08 19:35:28 +02:00

Refactor LT tests for parsers: token delimiters

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.
This commit is contained in:
Mike Pennisi 2019-01-01 11:44:28 -05:00
parent e515abfa0e
commit 6b49b770d8
5 changed files with 29 additions and 48 deletions

@ -1,22 +0,0 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: LINE SEPARATOR (U+2028) may occur between any two tokens
es5id: 7.3_A1.3
description: Insert LINE SEPARATOR (\u2028) between tokens of var x=1
---*/
var result;
// CHECK#1
eval("\u2028var\u2028x\u2028=\u20281\u2028; result = x;");
if (result !== 1) {
$ERROR('#1: eval("\\u2028var\\u2028x\\u2028=\\u20281\\u2028"); result === 1. Actual: ' + (result));
}
//CHECK#2
eval("\u2028" + "var" + "\u2028" + "x" + "\u2028" + "=" + "\u2028" + "2" + "\u2028; result = x;");
if (result !== 2) {
$ERROR('#2: eval("\\u2028" + "var" + "\\u2028" + "x" + "\\u2028" + "=" + "\\u2028" + "2" + "\\u2028"); result === 2. Actual: ' + (result));
}

@ -1,22 +0,0 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: PARAGRAPH SEPARATOR (U+2029) may occur between any two tokens
es5id: 7.3_A1.4
description: Insert PARAGRAPH SEPARATOR (\u2029) between tokens of var x=1
---*/
var result;
// CHECK#1
eval("\u2029var\u2029x\u2029=\u20291\u2029; result = x;");
if (result !== 1) {
$ERROR('#1: eval("\\u2029var\\u2029x\\u2029=\\u20291\\u2029"); result === 1. Actual: ' + (result));
}
//CHECK#2
eval("\u2029" + "var" + "\u2029" + "x" + "\u2029" + "=" + "\u2029" + "2" + "\u2029; result = x;");
if (result !== 2) {
$ERROR('#2: eval("\\u2029" + "var" + "\\u2029" + "x" + "\\u2029" + "=" + "\\u2029" + "2" + "\\u2029"); result === 2. Actual: ' + (result));
}

@ -3,15 +3,14 @@
/*---
info: LINE FEED (U+000A) may occur between any two tokens
esid: sec-line-terminators
es5id: 7.3_A1.1_T2
description: Insert real LINE FEED between tokens of var x=1
---*/
//CHECK#1
var
x
=
1;
if (x !== 1) {
$ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x));
}
assert.sameValue(x, 1);

@ -0,0 +1,13 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: LINE SEPARATOR (U+2028) may occur between any two tokens
esid: sec-line-terminators
es5id: 7.3_A1.3
description: Insert LINE SEPARATOR (\u2028) between tokens of var x=1
---*/
varx=1;
assert.sameValue(x, 1);

@ -0,0 +1,13 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: PARAGRAPH SEPARATOR (U+2029) may occur between any two tokens
esid: sec-line-terminators
es5id: 7.3_A1.4
description: Insert PARAGRAPH SEPARATOR (\u2029) between tokens of var x=1
---*/
varx=1;
assert.sameValue(x, 1);