Merge pull request #1404 from jugglinmike/refactor-for-parsers-function

Refactor function literal tests for parsers
This commit is contained in:
Leo Balter 2018-02-05 11:44:03 -05:00 committed by GitHub
commit 31dfa8761a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 260 additions and 182 deletions

View File

@ -9,4 +9,4 @@ description: >
flags: [noStrict] flags: [noStrict]
---*/ ---*/
eval("(function arguments (){});"); (function arguments (){});

View File

@ -7,10 +7,12 @@ description: >
StrictMode - SyntaxError is thrown if 'arguments' occurs as the StrictMode - SyntaxError is thrown if 'arguments' occurs as the
Identifier of a FunctionExpression whose FunctionBody is contained Identifier of a FunctionExpression whose FunctionBody is contained
in strict code in strict code
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var _13_1_42_s = {}; throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() {
eval("_13_1_42_s.x = function arguments() {'use strict';};"); (function arguments() {'use strict';});
});

View File

@ -6,10 +6,12 @@ es5id: 13.1-14-s
description: > description: >
StrictMode - SyntaxError is thrown if 'arguments' occurs as the StrictMode - SyntaxError is thrown if 'arguments' occurs as the
Identifier of a FunctionExpression in strict mode Identifier of a FunctionExpression in strict mode
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var _13_1_14_s = {}; throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() {
eval("_13_1_14_s.x = function arguments() {};"); (function arguments() {});
});

View File

@ -9,4 +9,4 @@ description: >
flags: [noStrict] flags: [noStrict]
---*/ ---*/
eval("(function eval(){});"); (function eval(){});

View File

@ -7,10 +7,12 @@ description: >
StrictMode - SyntaxError is thrown if 'eval' occurs as the StrictMode - SyntaxError is thrown if 'eval' occurs as the
Identifier of a FunctionExpression whose FunctionBody is contained Identifier of a FunctionExpression whose FunctionBody is contained
in strict code in strict code
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
var _13_1_38_s = {}; throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() {
eval("_13_1_38_s.x = function eval() {'use strict'; };"); (function eval() {'use strict';});
});

View File

@ -6,10 +6,12 @@ es5id: 13.1-12-s
description: > description: >
StrictMode - SyntaxError is thrown if 'eval' occurs as the StrictMode - SyntaxError is thrown if 'eval' occurs as the
Identifier of a FunctionExpression in strict mode Identifier of a FunctionExpression in strict mode
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var _13_1_12_s = {}; throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() {
eval("_13_1_12_s.x = function eval() {};"); (function eval() {});
});

View File

@ -9,4 +9,4 @@ description: >
flags: [noStrict] flags: [noStrict]
---*/ ---*/
eval("(function foo(arguments){});"); (function foo(arguments){});

View File

@ -9,4 +9,4 @@ description: >
flags: [noStrict] flags: [noStrict]
---*/ ---*/
eval('(function foo(a,a){})'); (function foo(a,a){});

View File

@ -11,10 +11,12 @@ description: >
Strict Mode - SyntaxError is thrown if a function is created in Strict Mode - SyntaxError is thrown if a function is created in
'strict mode' using a FunctionExpression and the function has two 'strict mode' using a FunctionExpression and the function has two
identical parameters identical parameters
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { (function (param, param) { });
eval("var _13_1_8_fun = function (param, param) { };");
});

View File

@ -12,10 +12,12 @@ description: >
'strict mode' using a FunctionExpression and the function has two 'strict mode' using a FunctionExpression and the function has two
identical parameters, which are separated by a unique parameter identical parameters, which are separated by a unique parameter
name name
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { (function (param1, param2, param1) { });
eval("var _13_1_9_fun = function (param1, param2, param1) { };");
});

View File

@ -11,10 +11,12 @@ description: >
Strict Mode - SyntaxError is thrown if a function is created in Strict Mode - SyntaxError is thrown if a function is created in
'strict mode' using a FunctionExpression and the function has 'strict mode' using a FunctionExpression and the function has
three identical parameters three identical parameters
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { (function (param, param, param) { });
eval("var _13_1_10_fun = function (param, param, param) { };")
});

View File

@ -11,10 +11,12 @@ description: >
Strict Mode - SyntaxError is thrown if a function is created using Strict Mode - SyntaxError is thrown if a function is created using
a FunctionExpression whose FunctionBody is contained in strict a FunctionExpression whose FunctionBody is contained in strict
code and the function has two identical parameters code and the function has two identical parameters
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { (function (param, param) { 'use strict'; });
eval("var _13_1_30_fun = function (param, param) { 'use strict'; };");
});

View File

@ -12,10 +12,12 @@ description: >
a FunctionExpression whose FunctionBody is strict and the function a FunctionExpression whose FunctionBody is strict and the function
has two identical parameters, which are separated by a unique has two identical parameters, which are separated by a unique
parameter name parameter name
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { (function (param1, param2, param1) { 'use strict'; });
eval("var _13_1_32_fun = function (param1, param2, param1) { 'use strict'; };");
});

View File

@ -10,10 +10,12 @@ es5id: 13.1-34-s
description: > description: >
Strict Mode - SyntaxError is thrown if a function declaration has Strict Mode - SyntaxError is thrown if a function declaration has
three identical parameters with a strict mode body three identical parameters with a strict mode body
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { (function (param, param, param) { 'use strict'; });
eval("var _13_1_34_fun = function (param, param, param) { 'use strict'; };")
});

View File

@ -9,4 +9,4 @@ description: >
flags: [noStrict] flags: [noStrict]
---*/ ---*/
eval("(function foo(eval){});"); (function foo(eval){});

View File

@ -11,10 +11,12 @@ description: >
StrictMode - SyntaxError is thrown if the identifier 'eval' StrictMode - SyntaxError is thrown if the identifier 'eval'
appears within a FormalParameterList of a strict mode appears within a FormalParameterList of a strict mode
FunctionExpression when FuctionBody is strict code FunctionExpression when FuctionBody is strict code
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { (function (eval) { 'use strict'; });
eval("var _13_1_18_fun = function (eval) { 'use strict'; }");
});

View File

@ -1,49 +0,0 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: The FunctionBody must be SourceElements
es5id: 13_A7_T2
description: >
Inserting elements that is different from SourceElements into the
FunctionBody
---*/
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
try{
eval("function __func(){/ ABC}");
$ERROR('#1: eval("function __func(){/ ABC}") lead to throwing exception');
} catch(e){
if(!(e instanceof SyntaxError)){
$ERROR('#1.1: eval("function __func(){/ ABC}") lead to throwing exception of SyntaxError. Actual: exception is '+e);
}
}
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//CHECK#3
try{
eval("function __func(){&1}");
$ERROR('#3: eval("function __func(){&1}") lead to throwing exception');
} catch(e){
if(!(e instanceof SyntaxError)){
$ERROR('#3.1: eval("function __func(){&1}") lead to throwing exception of SyntaxError. Actual: exception is '+e);
}
}
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//CHECK#4
try{
eval("function __func(){# ABC}");
$ERROR('#4: eval("function __func(){# ABC}") lead to throwing exception');
} catch(e){
if(!(e instanceof SyntaxError)){
$ERROR('#4.1: eval("function __func(){# ABC}") lead to throwing exception of SyntaxError. Actual: exception is '+e);
}
}
//
//////////////////////////////////////////////////////////////////////////////

View File

@ -10,16 +10,17 @@ description: >
Strict Mode - SourceElements is evaluated as strict mode code when Strict Mode - SourceElements is evaluated as strict mode code when
the code of this FunctionBody with an inner function contains a the code of this FunctionBody with an inner function contains a
Use Strict Directive Use Strict Directive
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function _13_0_10_fun() { throw "Test262: This statement should not be evaluated.";
function _13_0_10_fun() {
function _13_0_10_inner() { function _13_0_10_inner() {
"use strict"; "use strict";
eval("eval = 42;"); eval = 42;
} }
_13_0_10_inner(); }
};
assert.throws(SyntaxError, function() {
_13_0_10_fun();
});

View File

@ -10,16 +10,17 @@ description: >
Strict Mode - SourceElements is evaluated as strict mode code when Strict Mode - SourceElements is evaluated as strict mode code when
the code of this FunctionBody with an inner function which is in the code of this FunctionBody with an inner function which is in
strict mode strict mode
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function _13_0_11_fun() { throw "Test262: This statement should not be evaluated.";
function _13_0_11_fun() {
"use strict"; "use strict";
function _13_0_11_inner() { function _13_0_11_inner() {
eval("eval = 42;"); eval = 42;
} }
_13_0_11_inner(); }
};
assert.throws(SyntaxError, function() {
_13_0_11_fun();
});

View File

@ -10,13 +10,16 @@ description: >
Strict Mode - SourceElements is evaluated as strict mode code when Strict Mode - SourceElements is evaluated as strict mode code when
a FunctionDeclaration that is contained in strict mode code has an a FunctionDeclaration that is contained in strict mode code has an
inner function inner function
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var _13_0_9_fun = function () { throw "Test262: This statement should not be evaluated.";
function _13_0_9_inner() { eval("eval = 42;"); }
_13_0_9_inner(); var _13_0_9_fun = function () {
}; function _13_0_9_inner() {
assert.throws(SyntaxError, function() { eval = 42;
_13_0_9_fun(); }
}); };

View File

@ -6,9 +6,11 @@ es5id: 13.0-1
description: > description: >
13.0 - multiple names in one function declaration is not allowed, 13.0 - multiple names in one function declaration is not allowed,
two function names two function names
negative:
phase: parse
type: SyntaxError
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function x, y() {}
eval("function x, y() {}");
});

View File

@ -6,9 +6,11 @@ es5id: 13.0-2
description: > description: >
13.0 - multiple names in one function declaration is not allowed, 13.0 - multiple names in one function declaration is not allowed,
three function names three function names
negative:
phase: parse
type: SyntaxError
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function x,y,z(){}
eval("function x,y,z(){}");
});

View File

@ -0,0 +1,17 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: The FunctionBody must be SourceElements
es5id: 13_A7_T2
description: >
Inserting elements that is different from SourceElements into the
FunctionBody
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function __func(){/ ABC}

View File

@ -0,0 +1,17 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: The FunctionBody must be SourceElements
es5id: 13_A7_T2
description: >
Inserting elements that is different from SourceElements into the
FunctionBody
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function __func(){&1}

View File

@ -0,0 +1,17 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: The FunctionBody must be SourceElements
es5id: 13_A7_T2
description: >
Inserting elements that is different from SourceElements into the
FunctionBody
negative:
phase: parse
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
function __func(){# ABC}

View File

@ -6,9 +6,11 @@ es5id: 13.0-3
description: > description: >
13.0 - property names in function definition is not allowed, add a 13.0 - property names in function definition is not allowed, add a
new property into object new property into object
negative:
phase: parse
type: SyntaxError
---*/ ---*/
var obj = {}; throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() {
eval("function obj.tt() {};"); function obj.tt() {}
});

View File

@ -6,10 +6,11 @@ es5id: 13.0-4
description: > description: >
13.0 - multiple names in one function declaration is not allowed, 13.0 - multiple names in one function declaration is not allowed,
add a new property into a property which is a object add a new property into a property which is a object
negative:
phase: parse
type: SyntaxError
---*/ ---*/
var obj = {}; throw "Test262: This statement should not be evaluated.";
obj.tt = { len: 10 };
assert.throws(SyntaxError, function() { function obj.tt.ss() {}
eval("function obj.tt.ss() {};");
});

View File

@ -38,6 +38,12 @@ z
z(); z();
eval("function\u0009\u2029w(\u000C)\u00A0{\u000D};"); // The following function expression is expressed with literal unicode
// characters so that parsers may benefit from this test. The included code
// points are as follows:
//
// "function\u0009\u2029w(\u000C)\u00A0{\u000D}"
function w( ) { }
w(); w();

View File

@ -37,4 +37,12 @@ z
z(); z();
eval("function\u0009\u2029w(\u000C)\u00A0{\u000D}; w()"); // The following function expression is expressed with literal unicode
// characters so that parsers may benefit from this test. The included code
// points are as follows:
//
// "function\u0009\u2029w(\u000C)\u00A0{\u000D}"
function w( ) { }
w();

View File

@ -9,4 +9,4 @@ description: >
flags: [noStrict] flags: [noStrict]
---*/ ---*/
eval("function arguments (){};"); function arguments (){}

View File

@ -7,10 +7,12 @@ description: >
StrictMode - SyntaxError is thrown if 'arguments' occurs as the StrictMode - SyntaxError is thrown if 'arguments' occurs as the
Identifier of a FunctionDeclaration whose FunctionBody is Identifier of a FunctionDeclaration whose FunctionBody is
contained in strict code contained in strict code
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function arguments() { 'use strict'; }
eval("function arguments() { 'use strict'; };")
});

View File

@ -6,10 +6,12 @@ es5id: 13.1-13-s
description: > description: >
StrictMode - SyntaxError is thrown if 'arguments' occurs as the StrictMode - SyntaxError is thrown if 'arguments' occurs as the
function name of a FunctionDeclaration in strict mode function name of a FunctionDeclaration in strict mode
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function arguments() { }
eval("function arguments() { };")
});

View File

@ -9,4 +9,4 @@ description: >
flags: [noStrict] flags: [noStrict]
---*/ ---*/
eval("function eval(){};"); function eval(){}

View File

@ -7,10 +7,12 @@ description: >
StrictMode - SyntaxError is thrown if 'eval' occurs as the StrictMode - SyntaxError is thrown if 'eval' occurs as the
function name of a FunctionDeclaration whose FunctionBody is in function name of a FunctionDeclaration whose FunctionBody is in
strict mode strict mode
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function eval() { 'use strict'; }
eval("function eval() { 'use strict'; };")
});

View File

@ -6,10 +6,12 @@ es5id: 13.1-11-s
description: > description: >
StrictMode - SyntaxError is thrown if 'eval' occurs as the StrictMode - SyntaxError is thrown if 'eval' occurs as the
function name of a FunctionDeclaration in strict mode function name of a FunctionDeclaration in strict mode
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function eval() { }
eval("function eval() { };")
});

View File

@ -9,4 +9,4 @@ description: >
flags: [noStrict] flags: [noStrict]
---*/ ---*/
eval("function foo(arguments){};"); function foo(arguments){}

View File

@ -11,10 +11,12 @@ description: >
StrictMode - SyntaxError is thrown if the identifier 'arguments' StrictMode - SyntaxError is thrown if the identifier 'arguments'
appears within a FormalParameterList of a strict mode appears within a FormalParameterList of a strict mode
FunctionDeclaration when FuctionBody is strict code FunctionDeclaration when FuctionBody is strict code
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function _13_1_20_fun(arguments) { 'use strict'; }
eval("function _13_1_20_fun(arguments) { 'use strict'; }");
});

View File

@ -11,10 +11,12 @@ description: >
Strict Mode - SyntaxError is thrown if the identifier 'arguments' Strict Mode - SyntaxError is thrown if the identifier 'arguments'
appears within a FormalParameterList of a strict mode appears within a FormalParameterList of a strict mode
FunctionDeclaration FunctionDeclaration
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function _13_1_3_fun(arguments) { }
eval("function _13_1_3_fun(arguments) { }");
});

View File

@ -9,4 +9,4 @@ description: >
flags: [noStrict] flags: [noStrict]
---*/ ---*/
eval('function foo(a,a){}'); function foo(a,a){}

View File

@ -11,10 +11,12 @@ description: >
Strict Mode - SyntaxError is thrown if a function is declared in Strict Mode - SyntaxError is thrown if a function is declared in
'strict mode' using a FunctionDeclaration and the function has two 'strict mode' using a FunctionDeclaration and the function has two
identical parameters identical parameters
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function _13_1_5_fun(param, param) { }
eval("function _13_1_5_fun(param, param) { }");
});

View File

@ -12,10 +12,12 @@ description: >
'strict mode' using a FunctionDeclaration and the function has two 'strict mode' using a FunctionDeclaration and the function has two
identical parameters, which are separated by a unique parameter identical parameters, which are separated by a unique parameter
name name
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function _13_1_6_fun(param1, param2, param1) { }
eval("function _13_1_6_fun(param1, param2, param1) { }");
});

View File

@ -11,10 +11,12 @@ description: >
Strict Mode - SyntaxError is thrown if a function is created in Strict Mode - SyntaxError is thrown if a function is created in
'strict mode' using a FunctionDeclaration and the function has 'strict mode' using a FunctionDeclaration and the function has
three identical parameters three identical parameters
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function _13_1_7_fun(param, param, param) { }
eval("function _13_1_7_fun(param, param, param) { }");
});

View File

@ -11,10 +11,12 @@ description: >
Strict Mode - SyntaxError is thrown if a function is created using Strict Mode - SyntaxError is thrown if a function is created using
a FunctionDeclaration whose FunctionBody is contained in strict a FunctionDeclaration whose FunctionBody is contained in strict
code and the function has two identical parameters code and the function has two identical parameters
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function _13_1_24_fun(param, param) { 'use strict'; }
eval("function _13_1_24_fun(param, param) { 'use strict'; }");
});

View File

@ -12,10 +12,12 @@ description: >
a FunctionDeclaration whose FunctionBody is contained in strict a FunctionDeclaration whose FunctionBody is contained in strict
code and the function has two identical parameters which are code and the function has two identical parameters which are
separated by a unique parameter name separated by a unique parameter name
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function _13_1_26_fun(param1, param2, param1) { 'use strict'; }
eval("function _13_1_26_fun(param1, param2, param1) { 'use strict'; }");
});

View File

@ -11,10 +11,12 @@ description: >
Strict Mode - SyntaxError is thrown if a function is created using Strict Mode - SyntaxError is thrown if a function is created using
a FunctionDeclaration whose FunctionBody is contained in strict a FunctionDeclaration whose FunctionBody is contained in strict
code and the function has three identical parameters code and the function has three identical parameters
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function _13_1_28_fun(param, param, param) { 'use strict'; }
eval("function _13_1_28_fun(param, param, param) { 'use strict'; }");
});

View File

@ -9,4 +9,4 @@ description: >
flags: [noStrict] flags: [noStrict]
---*/ ---*/
eval("function foo(eval){};"); function foo(eval){};

View File

@ -11,10 +11,12 @@ description: >
StrictMode - SyntaxError is thrown if the identifier 'eval' StrictMode - SyntaxError is thrown if the identifier 'eval'
appears within a FormalParameterList of a strict mode appears within a FormalParameterList of a strict mode
FunctionDeclaration when FuctionBody is strict code FunctionDeclaration when FuctionBody is strict code
negative:
phase: parse
type: SyntaxError
flags: [noStrict] flags: [noStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function _13_1_16_fun(eval) { 'use strict'; }
eval("function _13_1_16_fun(eval) { 'use strict'; }");
});

View File

@ -11,10 +11,12 @@ description: >
Strict Mode - SyntaxError is thrown if the identifier 'eval' Strict Mode - SyntaxError is thrown if the identifier 'eval'
appears within a FormalParameterList of a strict mode appears within a FormalParameterList of a strict mode
FunctionDeclaration FunctionDeclaration
negative:
phase: parse
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() { function _13_1_1_fun(eval) { }
eval("function _13_1_1_fun(eval) { }");
});