Replace runTestCase with assert helpers [test/language/statements]

This commit is contained in:
André Bargull 2015-08-13 17:33:42 +02:00
parent 2d5e7e0d44
commit ee8a222125
56 changed files with 85 additions and 425 deletions

View File

@ -11,12 +11,6 @@ description: >
when a Function constructor is contained in strict mode code when a Function constructor is contained in strict mode code
within eval code within eval code
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
eval("'use strict'; var _13_0_17_fun = new Function('eval = 42;'); _13_0_17_fun();"); eval("'use strict'; var _13_0_17_fun = new Function('eval = 42;'); _13_0_17_fun();");
return true;
}
runTestCase(testcase);

View File

@ -10,19 +10,10 @@ 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 FunctionExpression is contained in non-strict the code of this FunctionExpression is contained in non-strict
mode but the call to eval is a direct call in strict mode code mode but the call to eval is a direct call in strict mode code
flags: [noStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(SyntaxError, function() {
"use strict";
try {
eval("var _13_0_8_fun = function () {eval = 42;};"); eval("var _13_0_8_fun = function () {eval = 42;};");
_13_0_8_fun(); _13_0_8_fun();
return false; });
} catch (e) {
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -6,17 +6,7 @@ es5id: 13.1-1-1
description: > description: >
Duplicate identifier allowed in non-strict function declaration Duplicate identifier allowed in non-strict function declaration
parameter list parameter list
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase()
{
try
{
eval('function foo(a,a){}'); eval('function foo(a,a){}');
return true;
}
catch (e) { return false }
}
runTestCase(testcase);

View File

@ -6,17 +6,7 @@ es5id: 13.1-1-2
description: > description: >
Duplicate identifier allowed in non-strict function expression Duplicate identifier allowed in non-strict function expression
parameter list parameter list
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase()
{
try
{
eval('(function foo(a,a){})'); eval('(function foo(a,a){})');
return true;
}
catch (e) { return false }
}
runTestCase(testcase);

View File

@ -6,17 +6,7 @@ es5id: 13.1-2-1
description: > description: >
eval allowed as formal parameter name of a non-strict function eval allowed as formal parameter name of a non-strict function
declaration declaration
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase()
{
try
{
eval("function foo(eval){};"); eval("function foo(eval){};");
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -6,17 +6,7 @@ es5id: 13.1-2-5
description: > description: >
arguments allowed as formal parameter name of a non-strict arguments allowed as formal parameter name of a non-strict
function declaration function declaration
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase()
{
try
{
eval("function foo(arguments){};"); eval("function foo(arguments){};");
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -6,13 +6,7 @@ es5id: 13.1-2-6
description: > description: >
arguments allowed as formal parameter name of a non-strict arguments allowed as formal parameter name of a non-strict
function expression function expression
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase()
{
eval("(function foo(arguments){});"); eval("(function foo(arguments){});");
return true;
}
runTestCase(testcase);

View File

@ -6,17 +6,7 @@ es5id: 13.1-3-1
description: > description: >
eval allowed as function identifier in non-strict function eval allowed as function identifier in non-strict function
declaration declaration
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase()
{
try
{
eval("function eval(){};"); eval("function eval(){};");
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -6,17 +6,7 @@ es5id: 13.1-3-2
description: > description: >
eval allowed as function identifier in non-strict function eval allowed as function identifier in non-strict function
expression expression
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase()
{
try
{
eval("(function eval(){});"); eval("(function eval(){});");
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -6,17 +6,7 @@ es5id: 13.1-3-7
description: > description: >
arguments allowed as function identifier in non-strict function arguments allowed as function identifier in non-strict function
declaration declaration
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase()
{
try
{
eval("function arguments (){};"); eval("function arguments (){};");
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -6,17 +6,7 @@ es5id: 13.1-3-8
description: > description: >
arguments allowed as function identifier in non-strict function arguments allowed as function identifier in non-strict function
expression expression
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase()
{
try
{
eval("(function arguments (){});"); eval("(function arguments (){});");
return true;
}
catch (e) { }
}
runTestCase(testcase);

View File

@ -6,17 +6,10 @@ es5id: 13.2-11-s
description: > description: >
StrictMode - enumerating over a function object looking for StrictMode - enumerating over a function object looking for
'caller' fails outside of the function 'caller' fails outside of the function
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var foo = Function("'use strict';"); var foo = Function("'use strict';");
for (var tempIndex in foo) { for (var tempIndex in foo) {
if (tempIndex === "caller") { assert.notSameValue(tempIndex, "caller", 'tempIndex');
return false;
} }
}
return true;
}
runTestCase(testcase);

View File

@ -6,11 +6,7 @@ es5id: 13.2-12-s
description: > description: >
StrictMode - enumerating over a function object looking for StrictMode - enumerating over a function object looking for
'caller' fails inside the function 'caller' fails inside the function
includes: [runTestCase.js]
---*/ ---*/
function testcase() { var foo = Function("'use strict'; for (var tempIndex in this) {assert.notSameValue(tempIndex, 'caller', 'tempIndex');}");
var foo = Function("'use strict'; for (var tempIndex in this) {if (tempIndex===\"caller\") {return false;}}; return true;"); foo.call(foo);
return foo.call(foo);
}
runTestCase(testcase);

View File

@ -6,17 +6,10 @@ es5id: 13.2-15-s
description: > description: >
StrictMode - enumerating over a function object looking for StrictMode - enumerating over a function object looking for
'arguments' fails outside of the function 'arguments' fails outside of the function
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var foo = new Function("'use strict';"); var foo = new Function("'use strict';");
for (var tempIndex in foo) { for (var tempIndex in foo) {
if (tempIndex === "arguments") { assert.notSameValue(tempIndex, "arguments", 'tempIndex');
return false;
} }
}
return true;
}
runTestCase(testcase);

View File

@ -6,11 +6,7 @@ es5id: 13.2-16-s
description: > description: >
StrictMode - enumerating over a function object looking for StrictMode - enumerating over a function object looking for
'arguments' fails inside the function 'arguments' fails inside the function
includes: [runTestCase.js]
---*/ ---*/
function testcase() { var foo = new Function("'use strict'; for (var tempIndex in this) {assert.notSameValue(tempIndex, 'arguments', 'tempIndex');}");
var foo = new Function("'use strict'; for (var tempIndex in this) {if (tempIndex===\"arguments\") {return false;}}; return true;"); foo.call(foo);
return foo.call(foo);
}
runTestCase(testcase);

View File

@ -6,17 +6,10 @@ es5id: 13.2-19-s
description: > description: >
StrictMode - enumerating over a function object looking for StrictMode - enumerating over a function object looking for
'arguments' fails outside of the function 'arguments' fails outside of the function
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var foo = Function("'use strict';"); var foo = Function("'use strict';");
for (var tempIndex in foo) { for (var tempIndex in foo) {
if (tempIndex === "arguments") { assert.notSameValue(tempIndex, "arguments", 'tempIndex');
return false;
} }
}
return true;
}
runTestCase(testcase);

View File

@ -7,11 +7,7 @@ description: >
StrictMode - enumerating over a function object looking for StrictMode - enumerating over a function object looking for
'arguments' fails inside the function 'arguments' fails inside the function
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { var foo = Function("'use strict'; for (var tempIndex in this) {assert.notSameValue(tempIndex, 'arguments', 'tempIndex');}");
var foo = Function("'use strict'; for (var tempIndex in this) {if (tempIndex===\"arguments\") {return false;}}; return true;"); foo.call(foo);
return foo.call(foo);
}
runTestCase(testcase);

View File

@ -7,16 +7,9 @@ description: >
StrictMode - enumerating over a function object looking for StrictMode - enumerating over a function object looking for
'caller' fails outside of the function 'caller' fails outside of the function
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo () {"use strict";} function foo () {"use strict";}
for (var tempIndex in foo) { for (var tempIndex in foo) {
if (tempIndex === "caller") { assert.notSameValue(tempIndex, "caller", 'tempIndex');
return false;
} }
}
return true;
}
runTestCase(testcase);

View File

@ -7,19 +7,13 @@ description: >
StrictMode - enumerating over a function object looking for StrictMode - enumerating over a function object looking for
'caller' fails inside the function 'caller' fails inside the function
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo () { function foo () {
"use strict"; "use strict";
for (var tempIndex in this) { for (var tempIndex in this) {
if (tempIndex==="caller") { assert.notSameValue(tempIndex, "caller", 'tempIndex');
return false;
} }
} }
return true;
} foo.call(foo);
return foo.call(foo);
}
runTestCase(testcase);

View File

@ -7,17 +7,10 @@ description: >
StrictMode - enumerating over a function object looking for StrictMode - enumerating over a function object looking for
'arguments' fails outside of the function 'arguments' fails outside of the function
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo () {"use strict";} function foo () {"use strict";}
for (var tempIndex in foo) { for (var tempIndex in foo) {
if (tempIndex === "arguments") { assert.notSameValue(tempIndex, "arguments", 'tempIndex');
return false;
} }
}
return true;
}
runTestCase(testcase);

View File

@ -7,19 +7,12 @@ description: >
StrictMode - enumerating over a function object looking for StrictMode - enumerating over a function object looking for
'arguments' fails inside the function 'arguments' fails inside the function
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() { function foo() {
"use strict"; "use strict";
for (var tempIndex in this) { for (var tempIndex in this) {
if (tempIndex==="arguments") { assert.notSameValue(tempIndex, "arguments", 'tempIndex');
return false;
} }
} }
return true; foo.call(foo);
}
return foo.call(foo);
}
runTestCase(testcase);

View File

@ -6,14 +6,11 @@ es5id: 13.2-3-s
description: > description: >
StrictMode - Writing or reading from a property named 'arguments' StrictMode - Writing or reading from a property named 'arguments'
of function objects is allowed under both strict and normal modes. of function objects is allowed under both strict and normal modes.
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var foo = function () { var foo = function () {
this.arguments = 12; this.arguments = 12;
} }
var obj = new foo(); var obj = new foo();
return obj.arguments === 12;
} assert.sameValue(obj.arguments, 12, 'obj.arguments');
runTestCase(testcase);

View File

@ -7,17 +7,10 @@ description: >
StrictMode - enumerating over a function object looking for StrictMode - enumerating over a function object looking for
'caller' fails outside of the function 'caller' fails outside of the function
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var foo = new Function("'use strict';"); var foo = new Function("'use strict';");
for (var tempIndex in foo) { for (var tempIndex in foo) {
if (tempIndex === "caller") { assert.notSameValue(tempIndex, "caller", 'tempIndex');
return false;
} }
}
return true;
}
runTestCase(testcase);

View File

@ -7,11 +7,7 @@ description: >
StrictMode - enumerating over a function object looking for StrictMode - enumerating over a function object looking for
'caller' fails inside the function 'caller' fails inside the function
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { var foo = new Function("'use strict'; for (var tempIndex in this) {assert.notSameValue(tempIndex, 'caller', 'tempIndex');}");
var foo = new Function("'use strict'; for (var tempIndex in this) {if (tempIndex===\"caller\") {return false;}}; return true;"); foo.call(foo);
return foo.call(foo);
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
catch doesn't change declaration scope - var initializer in catch catch doesn't change declaration scope - var initializer in catch
with same name as catch parameter changes parameter with same name as catch parameter changes parameter
features: [AnnexB] features: [AnnexB]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
foo = "prior to throw"; foo = "prior to throw";
try { try {
throw new Error(); throw new Error();
@ -18,7 +16,5 @@ function testcase() {
catch (foo) { catch (foo) {
var foo = "initializer in catch"; var foo = "initializer in catch";
} }
return foo === "prior to throw";
} assert.sameValue(foo, "prior to throw");
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 12.14-10 es5id: 12.14-10
description: catch introduces scope - name lookup finds function parameter description: catch introduces scope - name lookup finds function parameter
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function f(o) { function f(o) {
function innerf(o, x) { function innerf(o, x) {
@ -22,8 +20,4 @@ function testcase() {
return innerf(o, 42); return innerf(o, 42);
} }
if (f({}) === 42) { assert.sameValue(f({}), 42);
return true;
}
}
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 12.14-11 es5id: 12.14-11
description: catch introduces scope - name lookup finds inner variable description: catch introduces scope - name lookup finds inner variable
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function f(o) { function f(o) {
function innerf(o) { function innerf(o) {
@ -24,8 +22,4 @@ function testcase() {
return innerf(o); return innerf(o);
} }
if (f({}) === 42) { assert.sameValue(f({}), 42);
return true;
}
}
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 12.14-12 es5id: 12.14-12
description: catch introduces scope - name lookup finds property description: catch introduces scope - name lookup finds property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function f(o) { function f(o) {
function innerf(o) { function innerf(o) {
@ -22,8 +20,4 @@ function testcase() {
return innerf(o); return innerf(o);
} }
if (f({x:42}) === 42) { assert.sameValue(f({x:42}), 42);
return true;
}
}
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
catch doesn't change declaration scope - var initializer in catch catch doesn't change declaration scope - var initializer in catch
with same name as catch parameter changes parameter with same name as catch parameter changes parameter
features: [AnnexB] features: [AnnexB]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function capturedFoo() {return foo}; function capturedFoo() {return foo};
foo = "prior to throw"; foo = "prior to throw";
try { try {
@ -18,8 +16,6 @@ function testcase() {
} }
catch (foo) { catch (foo) {
var foo = "initializer in catch"; var foo = "initializer in catch";
return capturedFoo() !== "initializer in catch";
} }
} assert.sameValue(capturedFoo(), "prior to throw");
runTestCase(testcase);

View File

@ -14,10 +14,8 @@ es5id: 12.14-3
description: > description: >
catch doesn't change declaration scope - var declaration are catch doesn't change declaration scope - var declaration are
visible outside when name different from catch parameter visible outside when name different from catch parameter
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try { try {
throw new Error(); throw new Error();
} }
@ -25,6 +23,4 @@ function testcase() {
var foo = "declaration in catch"; var foo = "declaration in catch";
} }
return foo === "declaration in catch"; assert.sameValue(foo, "declaration in catch");
}
runTestCase(testcase);

View File

@ -12,10 +12,8 @@ info: >
eval should use the appended object to the scope chain eval should use the appended object to the scope chain
es5id: 12.14-4 es5id: 12.14-4
description: catch introduces scope - block-local vars must shadow outer vars description: catch introduces scope - block-local vars must shadow outer vars
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var o = { foo : 42}; var o = { foo : 42};
try { try {
@ -23,10 +21,6 @@ function testcase() {
} }
catch (e) { catch (e) {
var foo; var foo;
}
if (foo === undefined) { assert.sameValue(foo, undefined);
return true;
}
}
}
runTestCase(testcase);

View File

@ -14,10 +14,8 @@ es5id: 12.14-6
description: > description: >
catch introduces scope - block-local function expression must catch introduces scope - block-local function expression must
shadow outer function expression shadow outer function expression
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var o = {foo : function () { return 42;}}; var o = {foo : function () { return 42;}};
try { try {
@ -25,9 +23,6 @@ function testcase() {
} }
catch (e) { catch (e) {
var foo = function () {}; var foo = function () {};
if (foo() === undefined) {
return true;
} }
}
} assert.sameValue(foo(), undefined);
runTestCase(testcase);

View File

@ -12,10 +12,8 @@ info: >
eval should use the appended object to the scope chain eval should use the appended object to the scope chain
es5id: 12.14-7 es5id: 12.14-7
description: catch introduces scope - scope removed when exiting catch block description: catch introduces scope - scope removed when exiting catch block
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var o = {foo: 1}; var o = {foo: 1};
var catchAccessed = false; var catchAccessed = false;
@ -25,13 +23,14 @@ function testcase() {
catch (expObj) { catch (expObj) {
catchAccessed = (expObj.foo == 1); catchAccessed = (expObj.foo == 1);
} }
assert(catchAccessed, '(expObj.foo == 1)');
catchAccessed = false;
try { try {
expObj; expObj;
} }
catch (e) { catch (e) {
return catchAccessed && e instanceof ReferenceError catchAccessed = e instanceof ReferenceError
} }
return false; assert(catchAccessed, 'e instanceof ReferenceError');
}
runTestCase(testcase);

View File

@ -14,10 +14,8 @@ es5id: 12.14-8
description: > description: >
catch introduces scope - scope removed when exiting catch block catch introduces scope - scope removed when exiting catch block
(properties) (properties)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var o = {foo: 42}; var o = {foo: 42};
try { try {
@ -27,8 +25,4 @@ function testcase() {
var foo = 1; var foo = 1;
} }
if (o.foo === 42) { assert.sameValue(o.foo, 42);
return true;
}
}
runTestCase(testcase);

View File

@ -4,10 +4,8 @@
/*--- /*---
es5id: 12.14-9 es5id: 12.14-9
description: catch introduces scope - name lookup finds outer variable description: catch introduces scope - name lookup finds outer variable
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function f(o) { function f(o) {
var x = 42; var x = 42;
@ -23,8 +21,4 @@ function testcase() {
return innerf(o); return innerf(o);
} }
if (f({}) === 42) { assert.sameValue(f({}), 42);
return true;
}
}
runTestCase(testcase);

View File

@ -7,15 +7,14 @@ description: >
Strict Mode - SyntaxError isn't thrown if a TryStatement with a Strict Mode - SyntaxError isn't thrown if a TryStatement with a
Catch occurs within strict code and the Identifier of the Catch Catch occurs within strict code and the Identifier of the Catch
production is EVAL production is EVAL
includes: [runTestCase.js]
---*/ ---*/
function testcase() { var isInstance = false;
try { try {
throw new Error("..."); throw new Error("...");
return false;
} catch (EVAL) { } catch (EVAL) {
return EVAL instanceof Error; isInstance = EVAL instanceof Error;
} }
}
runTestCase(testcase); assert(isInstance);

View File

@ -7,15 +7,14 @@ description: >
Strict Mode - SyntaxError isn't thrown if a TryStatement with a Strict Mode - SyntaxError isn't thrown if a TryStatement with a
Catch occurs within strict code and the Identifier of the Catch Catch occurs within strict code and the Identifier of the Catch
production is Arguments production is Arguments
includes: [runTestCase.js]
---*/ ---*/
function testcase() { var isInstance = false;
try { try {
throw new Error("..."); throw new Error("...");
return false;
} catch (Arguments) { } catch (Arguments) {
return Arguments instanceof Error; isInstance = Arguments instanceof Error;
} }
}
runTestCase(testcase); assert(isInstance);

View File

@ -7,15 +7,14 @@ description: >
Strict Mode - SyntaxError isn't thrown if a TryStatement with a Strict Mode - SyntaxError isn't thrown if a TryStatement with a
Catch occurs within strict code and the Identifier of the Catch Catch occurs within strict code and the Identifier of the Catch
production is ARGUMENTS production is ARGUMENTS
includes: [runTestCase.js]
---*/ ---*/
function testcase() { var isInstance = false;
try { try {
throw new Error("..."); throw new Error("...");
return false;
} catch (ARGUMENTS) { } catch (ARGUMENTS) {
return ARGUMENTS instanceof Error; isInstance = ARGUMENTS instanceof Error;
} }
}
runTestCase(testcase); assert(isInstance);

View File

@ -4,12 +4,10 @@
/*--- /*---
es5id: 12.2.1-11 es5id: 12.2.1-11
description: arguments as var identifier in eval code is allowed description: arguments as var identifier in eval code is allowed
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() { function testcase() {
eval("var arguments;"); eval("var arguments;");
return true;
} }
runTestCase(testcase); testcase();

View File

@ -4,12 +4,7 @@
/*--- /*---
es5id: 12.2.1-12 es5id: 12.2.1-12
description: arguments as local var identifier is allowed description: arguments as local var identifier is allowed
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() {
eval("(function (){var arguments;})"); eval("(function (){var arguments;})");
return true;
}
runTestCase(testcase);

View File

@ -6,11 +6,6 @@ es5id: 12.2.1-16-s
description: > description: >
A Function constructor (called as a function) declaring a var A Function constructor (called as a function) declaring a var
named 'arguments' does not throw a SyntaxError named 'arguments' does not throw a SyntaxError
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
Function('var arguments;'); Function('var arguments;');
return true;
}
runTestCase(testcase);

View File

@ -8,12 +8,7 @@ description: >
'arguments' will not throw any error if contained within strict 'arguments' will not throw any error if contained within strict
mode and its body does not start with strict mode mode and its body does not start with strict mode
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var f = Function('arguments = 42;'); var f = Function('arguments = 42;');
f(); f();
return true;
}
runTestCase(testcase);

View File

@ -6,12 +6,7 @@ es5id: 12.2.1-20-s
description: > description: >
Strict Mode: an indirect eval declaring a var named 'arguments' Strict Mode: an indirect eval declaring a var named 'arguments'
does not throw does not throw
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var s = eval; var s = eval;
s('var arguments;'); s('var arguments;');
return true;
}
runTestCase(testcase);

View File

@ -6,12 +6,7 @@ es5id: 12.2.1-21-s
description: > description: >
Strict Mode: an indirect eval assigning into 'arguments' does not Strict Mode: an indirect eval assigning into 'arguments' does not
throw throw
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var s = eval; var s = eval;
s('arguments = 42;'); s('arguments = 42;');
return true;
}
runTestCase(testcase);

View File

@ -5,12 +5,7 @@
es5id: 12.2.1-9-s es5id: 12.2.1-9-s
description: > description: >
an indirect eval declaring a var named 'eval' does not throw an indirect eval declaring a var named 'eval' does not throw
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var s = eval; var s = eval;
s('var eval;'); s('var eval;');
return true;
}
runTestCase(testcase);

View File

@ -4,11 +4,9 @@
/*--- /*---
es5id: 12.10-0-10 es5id: 12.10-0-10
description: with introduces scope - name lookup finds function parameter description: with introduces scope - name lookup finds function parameter
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() {
function f(o) { function f(o) {
function innerf(o, x) { function innerf(o, x) {
@ -20,8 +18,4 @@ function testcase() {
return innerf(o, 42); return innerf(o, 42);
} }
if (f({}) === 42) { assert.sameValue(f({}), 42);
return true;
}
}
runTestCase(testcase);

View File

@ -4,11 +4,9 @@
/*--- /*---
es5id: 12.10-0-11 es5id: 12.10-0-11
description: with introduces scope - name lookup finds inner variable description: with introduces scope - name lookup finds inner variable
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() {
function f(o) { function f(o) {
function innerf(o) { function innerf(o) {
@ -22,8 +20,4 @@ function testcase() {
return innerf(o); return innerf(o);
} }
if (f({}) === 42) { assert.sameValue(f({}), 42);
return true;
}
}
runTestCase(testcase);

View File

@ -4,11 +4,9 @@
/*--- /*---
es5id: 12.10-0-12 es5id: 12.10-0-12
description: with introduces scope - name lookup finds property description: with introduces scope - name lookup finds property
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() {
function f(o) { function f(o) {
function innerf(o) { function innerf(o) {
@ -20,8 +18,4 @@ function testcase() {
return innerf(o); return innerf(o);
} }
if (f({x:42}) === 42) { assert.sameValue(f({x:42}), 42);
return true;
}
}
runTestCase(testcase);

View File

@ -4,11 +4,9 @@
/*--- /*---
es5id: 12.10-0-7 es5id: 12.10-0-7
description: with introduces scope - scope removed when exiting with statement description: with introduces scope - scope removed when exiting with statement
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() {
var o = {foo: 1}; var o = {foo: 1};
with (o) { with (o) {
@ -17,9 +15,8 @@ function testcase() {
try { try {
foo; foo;
throw new Error();
} }
catch (e) { catch (e) {
return true; assert(e instanceof ReferenceError);
} }
}
runTestCase(testcase);

View File

@ -4,11 +4,9 @@
/*--- /*---
es5id: 12.10-0-9 es5id: 12.10-0-9
description: with introduces scope - name lookup finds outer variable description: with introduces scope - name lookup finds outer variable
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() {
function f(o) { function f(o) {
var x = 42; var x = 42;
@ -21,8 +19,4 @@ function testcase() {
return innerf(o); return innerf(o);
} }
if (f({}) === 42) { assert.sameValue(f({}), 42);
return true;
}
}
runTestCase(testcase);

View File

@ -4,23 +4,13 @@
/*--- /*---
es5id: 12.10-2-1 es5id: 12.10-2-1
description: with - expression being Number description: with - expression being Number
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() {
var o = 2; var o = 2;
var foo = 1; var foo = 1;
try
{
with (o) { with (o) {
foo = 42; foo = 42;
} }
}
catch(e)
{
}
return true;
} assert.sameValue(foo, 42);
runTestCase(testcase);

View File

@ -4,23 +4,13 @@
/*--- /*---
es5id: 12.10-2-2 es5id: 12.10-2-2
description: with - expression being Boolean description: with - expression being Boolean
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() {
var o = true; var o = true;
var foo = 1; var foo = 1;
try
{
with (o) { with (o) {
foo = 42; foo = 42;
} }
}
catch(e)
{
}
return true;
} assert.sameValue(foo, 42);
runTestCase(testcase);

View File

@ -4,23 +4,13 @@
/*--- /*---
es5id: 12.10-2-3 es5id: 12.10-2-3
description: with - expression being string description: with - expression being string
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() {
var o = "str"; var o = "str";
var foo = 1; var foo = 1;
try
{
with (o) { with (o) {
foo = 42; foo = 42;
} }
}
catch(e)
{
}
return true;
} assert.sameValue(foo, 42);
runTestCase(testcase);

View File

@ -4,28 +4,21 @@
/*--- /*---
es5id: 12.10-7-1 es5id: 12.10-7-1
description: with introduces scope - restores the earlier environment on exit description: with introduces scope - restores the earlier environment on exit
includes: [runTestCase.js]
flags: [noStrict] flags: [noStrict]
---*/ ---*/
function testcase() {
var a = 1; var a = 1;
var o = {a : 2}; var o = {a : 2};
try try {
{
with (o) { with (o) {
a = 3; a = 3;
throw 1; throw 1;
a = 4; a = 4;
} }
} } catch (e) {
catch(e) // intentionally ignored
{}
if (a === 1 && o.a === 3) {
return true;
} }
} assert.sameValue(a, 1, 'a');
runTestCase(testcase); assert.sameValue(o.a, 3, 'o.a');

View File

@ -7,13 +7,8 @@ description: >
Strict Mode - SyntaxError isn't thrown when WithStatement body is Strict Mode - SyntaxError isn't thrown when WithStatement body is
in strict mode code in strict mode code
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
with ({}) { with ({}) {
"use strict"; "use strict";
} }
return true;
}
runTestCase(testcase);

View File

@ -7,13 +7,6 @@ description: >
with statement allowed in nested Function even if its container with statement allowed in nested Function even if its container
Function is strict) Function is strict)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
Function("\'use strict\'; var f1 = Function( \"var o = {}; with (o) {};\")"); Function("\'use strict\'; var f1 = Function( \"var o = {}; with (o) {};\")");
return true;
}
runTestCase(testcase);