Merge pull request #1840 from jugglinmike/refactor-for-parsers-var

Refactor variable declaration tests for parsers
This commit is contained in:
Leo Balter 2018-11-05 10:12:24 -05:00 committed by GitHub
commit ecb5fcbe33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 419 additions and 99 deletions

View File

@ -0,0 +1,19 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-for-statement
description: >
'for(var arguments = 42 in ...) {...}' throws SyntaxError in
strict mode within a function declaration
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function f() {
for (var arguments = 42 in null) {}
}

View File

@ -0,0 +1,19 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-for-statement
description: >
'for(var arguments in ...) {...}' throws SyntaxError in strict mode within a
function declaration
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function f() {
for (var arguments in null) {}
}

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) {}

View File

@ -1,13 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-13-s
description: arguments assignment throws SyntaxError in strict mode
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval('function foo() { arguments = 42; }; foo()');
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-14-s
description: >
arguments - a function expr declaring a var named 'arguments'
throws SyntaxError in strict mode
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval('(function (){var arguments;});');
});

View File

@ -1,15 +0,0 @@
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-15-s
description: >
arguments - a function expr assigning into 'arguments' throws a
SyntaxError in strict mode
flags: [onlyStrict]
---*/
assert.throws(SyntaxError, function() {
eval('(function () {arguments = 42;})()');
});

View File

@ -0,0 +1,14 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-12
esid: sec-variable-statement
description: >
arguments as local var identifier is allowed within a function declaration
flags: [noStrict]
---*/
function f() {
var arguments;
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-28-s
esid: sec-variable-statement
description: >
arguments as local var identifier assigned to throws SyntaxError
in strict mode within a function declaration
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function f() {
var a, arguments = 42;
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-30-s
esid: sec-variable-statement
description: >
arguments as local var identifier throws SyntaxError in strict mode within a
function declaration
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function f() {
var a = 42, arguments;
}

View File

@ -0,0 +1,19 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-variable-statement
description: >
arguments as local var identifier throws SyntaxError in strict mode within a
function declaration
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function f() {
var arguments = 42, a;
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-25-s
esid: sec-variable-statement
description: >
arguments as local var identifier throws SyntaxError in strict mode within a
function declaration
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function f() {
var arguments, a;
}

View File

@ -0,0 +1,19 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-variable-statement
description: >
arguments as local var identifier throws SyntaxError in strict mode within a
function declaration
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function f() {
var a, arguments = 42, b;
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-33-s
esid: sec-variable-statement
description: >
arguments as local var identifier throws SyntaxError in strict mode within a
function declaration
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function f() {
var a, arguments, b;
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-32-s
esid: sec-variable-statement
description: >
arguments as local var identifier defined twice and assigned once
throws SyntaxError in strict mode within a function declaration
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function f() {
var arguments, arguments = 42;
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-23-s
esid: sec-variable-statement
description: >
arguments as local var identifier assigned to throws SyntaxError
in strict mode within a function declaration
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function f() {
var arguments = 42;
}

View File

@ -0,0 +1,20 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 12.2.1-12-s
esid: sec-variable-statement
description: >
arguments as local var identifier throws SyntaxError in strict mode within a
function declaration
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function f() {
var arguments;
}

View File

@ -3,8 +3,9 @@
/*---
es5id: 12.2.1-12
esid: sec-variable-statement
description: arguments as local var identifier is allowed
flags: [noStrict]
---*/
eval("(function (){var arguments;})");
var arguments;

View File

@ -3,13 +3,16 @@
/*---
es5id: 12.2.1-28-s
esid: sec-variable-statement
description: >
arguments as local var identifier assigned to 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('function foo() { var a, arguments = 42;}');
});
var a, arguments = 42;

View File

@ -3,11 +3,14 @@
/*---
es5id: 12.2.1-30-s
esid: sec-variable-statement
description: arguments as local var identifier 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('function foo() { var a = 42, arguments;}');
});
var a = 42, arguments;

View File

@ -0,0 +1,15 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-variable-statement
description: arguments as local var identifier throws SyntaxError in strict mode
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
var arguments = 42, a;

View File

@ -3,11 +3,14 @@
/*---
es5id: 12.2.1-25-s
esid: sec-variable-statement
description: arguments as local var identifier 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('function foo() { var arguments, a;}');
});
var arguments, a;

View File

@ -0,0 +1,15 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-variable-statement
description: arguments as local var identifier throws SyntaxError in strict mode
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
var a, arguments = 42, b;

View File

@ -3,11 +3,14 @@
/*---
es5id: 12.2.1-33-s
esid: sec-variable-statement
description: arguments as local var identifier 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('function foo() { var a, arguments, b;}');
});
var a, arguments, b;

View File

@ -3,13 +3,16 @@
/*---
es5id: 12.2.1-32-s
esid: sec-variable-statement
description: >
arguments as local var identifier defined twice and assigned once
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('function foo() { var arguments, arguments = 42;}');
});
var arguments, arguments = 42;

View File

@ -3,13 +3,16 @@
/*---
es5id: 12.2.1-23-s
esid: sec-variable-statement
description: >
arguments as local var identifier assigned to 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('function foo() { var arguments = 42;}');
});
var arguments = 42;

View File

@ -3,11 +3,14 @@
/*---
es5id: 12.2.1-12-s
esid: sec-variable-statement
description: arguments as local var identifier 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('function foo() { var arguments;}');
});
var arguments;

View File

@ -0,0 +1,10 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-variable-statement
description: arguments as local var identifier is allowed
flags: [noStrict]
---*/
var eval;

View File

@ -0,0 +1,15 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-variable-statement
description: eval as local var identifier throws SyntaxError in strict mode
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
var a, eval = 42;

View File

@ -3,11 +3,14 @@
/*---
es5id: 12.2.1-26-s
esid: sec-variable-statement
description: eval as local var identifier 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('function foo() { var a, eval;}');
});
var a, eval;

View File

@ -3,13 +3,16 @@
/*---
es5id: 12.2.1-27-s
esid: sec-variable-statement
description: >
eval as local var identifier assigned to 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('function foo() { var eval = 42, a;}');
});
var eval = 42, a;

View File

@ -3,11 +3,14 @@
/*---
es5id: 12.2.1-29-s
esid: sec-variable-statement
description: eval as local var identifier 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('function foo() { var eval, a = 42;}');
});
var eval, a = 42;

View File

@ -0,0 +1,15 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-variable-statement
description: arguments as local var identifier throws SyntaxError in strict mode
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
var a, eval = 42, b;

View File

@ -0,0 +1,15 @@
// Copyright (c) 2018 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-variable-statement
description: arguments as local var identifier throws SyntaxError in strict mode
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
var a, eval, b;

View File

@ -3,13 +3,16 @@
/*---
es5id: 12.2.1-31-s
esid: sec-variable-statement
description: >
eval as local var identifier defined twice 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('function foo() { var eval, eval;}');
});
var eval, eval;

View File

@ -3,13 +3,16 @@
/*---
es5id: 12.2.1-24-s
esid: sec-variable-statement
description: >
eval as local var identifier assigned to 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('function foo() { var eval = 42;}');
});
var eval = 42;

View File

@ -3,13 +3,16 @@
/*---
es5id: 12.2.1-1-s
esid: sec-variable-statement
description: >
eval - a function declaring a var named 'eval' 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('function foo() { var eval; }');
});
var eval;