Relocate and refactor tests

The tests for the parsing of `for/in` loops 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. Move the tests to the `for-in` directory to better reflect
the grammar production that they test.
This commit is contained in:
Mike Pennisi 2018-09-23 21:32:15 -04:00
parent 835c202b36
commit ceb79988ae
4 changed files with 24 additions and 16 deletions

View File

@ -2,14 +2,16 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-37-s
esid: sec-for-statement
description: >
'for(var arguments = 42 in ...) {...}' throws SyntaxError in
strict mode
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() {
eval('for (var arguments = 42 in null) {};');
});
for (var arguments = 42 in null) {}

View File

@ -2,12 +2,14 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-36-s
esid: sec-for-statement
description: "'for(var arguments in ...) {...}' throws SyntaxError in strict mode"
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() {
eval('for (var arguments in null) {};');
});
for (var arguments in null) {}

View File

@ -2,12 +2,14 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-35-s
esid: sec-for-statement
description: "'for(var eval = 42 in ...) {...}' throws SyntaxError in strict mode"
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() {
eval('for (var eval = 42 in null) {};');
});
for (var eval = 42 in null) {}

View File

@ -2,12 +2,14 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-34-s
esid: sec-for-statement
description: "'for(var eval in ...) {...}' throws SyntaxError in strict mode"
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() {
eval('for (var eval in null) {};');
});
for (var eval in null) {}