Merge pull request #416 from anba/remove-runTestCase-language-rest

Replace runTestCase in test/language (part 2)
This commit is contained in:
Rick Waldron 2015-09-04 15:18:40 -04:00
commit 2bfe4a4716
342 changed files with 750 additions and 2468 deletions

View File

@ -5,16 +5,9 @@
es5id: 10.6-12-1 es5id: 10.6-12-1
description: Accessing callee property of Arguments object is allowed description: Accessing callee property of Arguments object is allowed
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
try
{
arguments.callee; arguments.callee;
return true;
} }
catch (e) { testcase();
}
}
runTestCase(testcase);

View File

@ -5,17 +5,15 @@
es5id: 10.6-12-2 es5id: 10.6-12-2
description: arguments.callee has correct attributes description: arguments.callee has correct attributes
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var desc = Object.getOwnPropertyDescriptor(arguments,"callee"); var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
if(desc.configurable === true &&
desc.enumerable === false && assert.sameValue(desc.configurable, true, 'desc.configurable');
desc.writable === true && assert.sameValue(desc.enumerable, false, 'desc.enumerable');
desc.hasOwnProperty('get') == false && assert.sameValue(desc.writable, true, 'desc.writable');
desc.hasOwnProperty('put') == false) assert.sameValue(desc.hasOwnProperty('get'), false, 'desc.hasOwnProperty("get")');
return true; assert.sameValue(desc.hasOwnProperty('set'), false, 'desc.hasOwnProperty("set")');
} }
runTestCase(testcase); testcase();

View File

@ -5,16 +5,9 @@
es5id: 10.6-13-1 es5id: 10.6-13-1
description: Accessing caller property of Arguments object is allowed description: Accessing caller property of Arguments object is allowed
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
try
{
arguments.caller; arguments.caller;
return true;
} }
catch (e) { testcase();
}
}
runTestCase(testcase);

View File

@ -5,11 +5,10 @@
es5id: 10.6-13-b-2-s es5id: 10.6-13-b-2-s
description: arguments.caller exists in strict mode description: arguments.caller exists in strict mode
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var desc = Object.getOwnPropertyDescriptor(arguments,"caller"); var desc = Object.getOwnPropertyDescriptor(arguments,"caller");
return desc!== undefined; assert.notSameValue(desc, undefined);
} }
runTestCase(testcase); testcase();

View File

@ -5,18 +5,16 @@
es5id: 10.6-13-b-3-s es5id: 10.6-13-b-3-s
description: arguments.caller is non-configurable in strict mode description: arguments.caller is non-configurable in strict mode
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var desc = Object.getOwnPropertyDescriptor(arguments,"caller"); var desc = Object.getOwnPropertyDescriptor(arguments,"caller");
return (desc.configurable === false && assert.sameValue(desc.configurable, false, 'desc.configurable');
desc.enumerable === false && assert.sameValue(desc.enumerable, false, 'desc.enumerable');
desc.hasOwnProperty('value') == false && assert.sameValue(desc.hasOwnProperty('value'), false, 'desc.hasOwnProperty("value")');
desc.hasOwnProperty('writable') == false && assert.sameValue(desc.hasOwnProperty('writable'), false, 'desc.hasOwnProperty("writable")');
desc.hasOwnProperty('get') == true && assert.sameValue(desc.hasOwnProperty('get'), true, 'desc.hasOwnProperty("get")');
desc.hasOwnProperty('set') == true); assert.sameValue(desc.hasOwnProperty('set'), true, 'desc.hasOwnProperty("set")');
} }
runTestCase(testcase); testcase();

View File

@ -4,11 +4,10 @@
/*--- /*---
es5id: 10.6-13-c-2-s es5id: 10.6-13-c-2-s
description: arguments.callee is exists description: arguments.callee is exists
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var desc = Object.getOwnPropertyDescriptor(arguments,"callee"); var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
return desc !== undefined; assert.notSameValue(desc, undefined);
} }
runTestCase(testcase); testcase();

View File

@ -5,16 +5,16 @@
es5id: 10.6-13-c-3-s es5id: 10.6-13-c-3-s
description: arguments.callee is non-configurable in strict mode description: arguments.callee is non-configurable in strict mode
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var desc = Object.getOwnPropertyDescriptor(arguments,"callee"); var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
return (desc.configurable === false &&
desc.enumerable === false && assert.sameValue(desc.configurable, false, 'desc.configurable');
desc.hasOwnProperty('value') == false && assert.sameValue(desc.enumerable, false, 'desc.enumerable');
desc.hasOwnProperty('writable') == false && assert.sameValue(desc.hasOwnProperty('value'), false, 'desc.hasOwnProperty("value")');
desc.hasOwnProperty('get') == true && assert.sameValue(desc.hasOwnProperty('writable'), false, 'desc.hasOwnProperty("writable")');
desc.hasOwnProperty('set') == true); assert.sameValue(desc.hasOwnProperty('get'), true, 'desc.hasOwnProperty("get")');
assert.sameValue(desc.hasOwnProperty('set'), true, 'desc.hasOwnProperty("set")');
} }
runTestCase(testcase); testcase();

View File

@ -6,11 +6,9 @@ es5id: 10.6-5-1
description: > description: >
[[Prototype]] property of Arguments is set to Object prototype [[Prototype]] property of Arguments is set to Object prototype
object object
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
if(Object.getPrototypeOf(arguments) === Object.getPrototypeOf({})) assert.sameValue(Object.getPrototypeOf(arguments), Object.getPrototypeOf({}));
return true;
} }
runTestCase(testcase); testcase();

View File

@ -4,12 +4,11 @@
/*--- /*---
es5id: 10.6-6-1 es5id: 10.6-6-1
description: "'length property of arguments object exists" description: "'length property of arguments object exists"
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var desc = Object.getOwnPropertyDescriptor(arguments,"length"); var desc = Object.getOwnPropertyDescriptor(arguments,"length");
return desc !== undefined assert.notSameValue(desc, undefined);
} }
runTestCase(testcase); testcase();

View File

@ -4,15 +4,13 @@
/*--- /*---
es5id: 10.6-6-2 es5id: 10.6-6-2
description: "'length' property of arguments object has correct attributes" description: "'length' property of arguments object has correct attributes"
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var desc = Object.getOwnPropertyDescriptor(arguments,"length"); var desc = Object.getOwnPropertyDescriptor(arguments,"length");
if(desc.configurable === true &&
desc.enumerable === false && assert.sameValue(desc.configurable, true, 'desc.configurable');
desc.writable === true ) assert.sameValue(desc.enumerable, false, 'desc.enumerable');
return true; assert.sameValue(desc.writable, true, 'desc.writable');
} }
runTestCase(testcase); testcase();

View File

@ -6,10 +6,9 @@ es5id: 10.6-6-3
description: > description: >
'length' property of arguments object for 0 argument function 'length' property of arguments object for 0 argument function
exists exists
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
return (function () {return arguments.length !== undefined})(); assert.sameValue(arguments.length, 0);
} }
runTestCase(testcase); testcase();

View File

@ -7,11 +7,10 @@ description: >
'length' property of arguments object for 0 argument function 'length' property of arguments object for 0 argument function
exists exists
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var arguments= undefined; var arguments= undefined;
return (function () {return arguments.length !== undefined})(); (function () { assert.sameValue(arguments.length, 0); })();
} }
runTestCase(testcase); testcase();

View File

@ -6,10 +6,9 @@ es5id: 10.6-6-4
description: > description: >
'length' property of arguments object for 0 argument function call 'length' property of arguments object for 0 argument function call
is 0 even with formal parameters is 0 even with formal parameters
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase(a,b,c) {
return (function (a,b,c) {return arguments.length === 0})(); assert.sameValue(arguments.length, 0);
} }
runTestCase(testcase); testcase();

View File

@ -7,11 +7,10 @@ description: >
'length' property of arguments object for 0 argument function call 'length' property of arguments object for 0 argument function call
is 0 even with formal parameters is 0 even with formal parameters
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var arguments= undefined; var arguments= undefined;
return (function (a,b,c) {return arguments.length === 0})(); (function (a,b,c) { assert.sameValue(arguments.length, 0); })();
} }
runTestCase(testcase); testcase();

View File

@ -7,12 +7,12 @@ description: >
Strict Mode - Use Strict Directive Prologue is 'use strict'; Strict Mode - Use Strict Directive Prologue is 'use strict';
which contains two space between 'use' and 'strict' which contains two space between 'use' and 'strict'
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
"use strict"; "use strict";
var public = 1; var public = 1;
return public === 1;
assert.sameValue(public, 1);
} }
runTestCase(testcase); testcase();

View File

@ -7,12 +7,12 @@ description: >
Strict Mode - Use Strict Directive Prologue is ''USE STRICT';' in Strict Mode - Use Strict Directive Prologue is ''USE STRICT';' in
which all characters are uppercase which all characters are uppercase
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
"USE STRICT"; "USE STRICT";
var public = 1; var public = 1;
return public === 1;
assert.sameValue(public, 1);
} }
runTestCase(testcase); testcase();

View File

@ -7,17 +7,16 @@ description: >
Strict Mode - Eval code is strict code with a Use Strict Directive Strict Mode - Eval code is strict code with a Use Strict Directive
at the beginning of the block at the beginning of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { var err = null;
try { try {
eval("'use strict'; var public = 1; var anotherVariableNotReserveWord = 2;"); eval("'use strict'; var public = 1; var anotherVariableNotReserveWord = 2;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && typeof public === "undefined" && err = e;
typeof anotherVariableNotReserveWord === "undefined";
} }
}
runTestCase(testcase); assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(typeof public, "undefined", 'typeof public');
assert.sameValue(typeof anotherVariableNotReserveWord, "undefined", 'typeof anotherVariableNotReserveWord');

View File

@ -7,11 +7,9 @@ description: >
Strict Mode - Eval code is strict eval code with a Use Strict Strict Mode - Eval code is strict eval code with a Use Strict
Directive in the middle of the block Directive in the middle of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
eval("var public = 1; 'use strict'; var anotherVariableNotReserveWord = 2;"); eval("var public = 1; 'use strict'; var anotherVariableNotReserveWord = 2;");
return public === 1 && anotherVariableNotReserveWord === 2;
} assert.sameValue(public, 1, 'public');
runTestCase(testcase); assert.sameValue(anotherVariableNotReserveWord, 2, 'anotherVariableNotReserveWord');

View File

@ -7,11 +7,9 @@ description: >
Strict Mode - Eval code is strict eval code with a Use Strict Strict Mode - Eval code is strict eval code with a Use Strict
Directive at the end of the block Directive at the end of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
eval("var public = 1; var anotherVariableNotReserveWord = 2; 'use strict';"); eval("var public = 1; var anotherVariableNotReserveWord = 2; 'use strict';");
return public === 1 && anotherVariableNotReserveWord === 2;
} assert.sameValue(public, 1, 'public');
runTestCase(testcase); assert.sameValue(anotherVariableNotReserveWord, 2, 'anotherVariableNotReserveWord');

View File

@ -7,16 +7,10 @@ description: >
Strict Mode - The call to eval function is contained in a Strict Strict Mode - The call to eval function is contained in a Strict
Mode block Mode block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(SyntaxError, function() {
'use strict'; 'use strict';
try {
eval("var public = 1;"); eval("var public = 1;");
return false; });
} catch (e) {
return true;
}
}
runTestCase(testcase);

View File

@ -8,20 +8,16 @@ description: >
is strict function code if FunctionDeclaration is contained in use is strict function code if FunctionDeclaration is contained in use
strict strict
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
"use strict"; "use strict";
function fun() { function fun() {
try {
eval("var public = 1;"); eval("var public = 1;");
return false;
} catch (e) {
return e instanceof SyntaxError;
}
} }
return fun(); assert.throws(SyntaxError, function() {
fun();
});
} }
runTestCase(testcase); testcase();

View File

@ -8,18 +8,13 @@ description: >
is strict function code if FunctionExpression is contained in use is strict function code if FunctionExpression is contained in use
strict strict
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
"use strict"; "use strict";
return function () {
try { assert.throws(SyntaxError, function() {
eval("var public = 1;"); eval("var public = 1;");
return false; });
} catch (e) {
return e instanceof SyntaxError;
} }
} (); testcase();
}
runTestCase(testcase);

View File

@ -8,12 +8,10 @@ description: >
PropertyAssignment is in Strict Mode if Accessor PropertyAssignment is in Strict Mode if Accessor
PropertyAssignment is contained in use strict(getter) PropertyAssignment is contained in use strict(getter)
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(SyntaxError, function() {
"use strict"; "use strict";
try {
var obj = {}; var obj = {};
Object.defineProperty(obj, "accProperty", { Object.defineProperty(obj, "accProperty", {
get: function () { get: function () {
@ -23,9 +21,4 @@ function testcase() {
}); });
var temp = obj.accProperty === 11; var temp = obj.accProperty === 11;
return false; });
} catch (e) {
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -8,14 +8,14 @@ description: >
PropertyAssignment is in Strict Mode if Accessor PropertyAssignment is in Strict Mode if Accessor
PropertyAssignment is contained in use strict(setter) PropertyAssignment is contained in use strict(setter)
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
"use strict";
try {
var obj = {};
var data = "data"; var data = "data";
assert.throws(SyntaxError, function() {
"use strict";
var obj = {};
Object.defineProperty(obj, "accProperty", { Object.defineProperty(obj, "accProperty", {
set: function (value) { set: function (value) {
eval("var public = 1;"); eval("var public = 1;");
@ -24,9 +24,6 @@ function testcase() {
}); });
obj.accProperty = "overrideData"; obj.accProperty = "overrideData";
return false; });
} catch (e) {
return e instanceof SyntaxError && data === "data"; assert.sameValue(data, "data", 'data unchanged');
}
}
runTestCase(testcase);

View File

@ -7,19 +7,14 @@ description: >
Strict Mode - Function code of a FunctionDeclaration contains Use Strict Mode - Function code of a FunctionDeclaration contains Use
Strict Directive which appears at the start of the block Strict Directive which appears at the start of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function fun() { function fun() {
"use strict"; "use strict";
try {
eval("var public = 1;"); eval("var public = 1;");
return false;
} catch (e) {
return e instanceof SyntaxError;
} }
}
return fun(); assert.throws(SyntaxError, function() {
} fun();
runTestCase(testcase); });

View File

@ -7,17 +7,10 @@ description: >
Strict Mode - Use Strict Directive Prologue is ''use strict'' Strict Mode - Use Strict Directive Prologue is ''use strict''
which lost the last character ';' which lost the last character ';'
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(SyntaxError, function() {
"use strict" "use strict"
try {
eval("var public = 1;");
return false;
} catch (e) {
return e instanceof SyntaxError;
}
} eval("var public = 1;");
runTestCase(testcase); });

View File

@ -7,15 +7,11 @@ description: >
Strict Mode - Function code of a FunctionDeclaration contains Use Strict Mode - Function code of a FunctionDeclaration contains Use
Strict Directive which appears in the middle of the block Strict Directive which appears in the middle of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function fun() { function fun() {
eval("var public = 1;"); eval("var public = 1;");
"use strict"; "use strict";
return public === 1; assert.sameValue(public, 1);
} }
return fun(); fun();
}
runTestCase(testcase);

View File

@ -7,15 +7,10 @@ description: >
Strict Mode - Function code of a FunctionDeclaration contains Use Strict Mode - Function code of a FunctionDeclaration contains Use
Strict Directive which appears at the end of the block Strict Directive which appears at the end of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function fun() { function fun() {
eval("var public = 1;"); eval("var public = 1;");
return public === 1; assert.sameValue(public, 1);
"use strict"; "use strict";
} }
return fun(); fun();
}
runTestCase(testcase);

View File

@ -7,18 +7,10 @@ description: >
Strict Mode - Function code of a FunctionExpression contains Use Strict Mode - Function code of a FunctionExpression contains Use
Strict Directive which appears at the start of the block Strict Directive which appears at the start of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(SyntaxError, function () {
return function () {
"use strict"; "use strict";
try {
eval("var public = 1;"); eval("var public = 1;");
return false; });
} catch (e) {
return e instanceof SyntaxError;
}
} ();
}
runTestCase(testcase);

View File

@ -7,14 +7,10 @@ description: >
Strict Mode - Function code of a FunctionExpression contains Use Strict Mode - Function code of a FunctionExpression contains Use
Strict Directive which appears in the middle of the block Strict Directive which appears in the middle of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { (function () {
return function () {
eval("var public = 1;"); eval("var public = 1;");
return public === 1; assert.sameValue(public, 1);
"use strict"; "use strict";
} (); }) ();
}
runTestCase(testcase);

View File

@ -7,14 +7,11 @@ description: >
Strict Mode - Function code of a FunctionExpression contains Use Strict Mode - Function code of a FunctionExpression contains Use
Strict Directive which appears at the end of the block Strict Directive which appears at the end of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { (function () {
return function () {
eval("var public = 1;"); eval("var public = 1;");
"use strict"; "use strict";
return public === 1;
} (); assert.sameValue(public, 1);
} }) ();
runTestCase(testcase);

View File

@ -8,13 +8,12 @@ description: >
contains Use Strict Directive which appears at the start of the contains Use Strict Directive which appears at the start of the
block(setter) block(setter)
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
try {
var obj = {};
var data = "data"; var data = "data";
assert.throws(SyntaxError, function() {
var obj = {};
Object.defineProperty(obj, "accProperty", { Object.defineProperty(obj, "accProperty", {
set: function (value) { set: function (value) {
"use strict"; "use strict";
@ -24,10 +23,6 @@ function testcase() {
}); });
obj.accProperty = "overrideData"; obj.accProperty = "overrideData";
});
return false; assert.sameValue(data, "data", 'data unchanged');
} catch (e) {
return e instanceof SyntaxError && data === "data";
}
}
runTestCase(testcase);

View File

@ -8,10 +8,8 @@ description: >
contains Use Strict Directive which appears in the middle of the contains Use Strict Directive which appears in the middle of the
block(getter) block(getter)
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
Object.defineProperty(obj, "accProperty", { Object.defineProperty(obj, "accProperty", {
get: function () { get: function () {
@ -20,6 +18,6 @@ function testcase() {
return 11; return 11;
} }
}); });
return obj.accProperty === 11 && public === 1;
} assert.sameValue(obj.accProperty, 11, 'obj.accProperty');
runTestCase(testcase); assert.sameValue(public, 1, 'public');

View File

@ -8,10 +8,8 @@ description: >
contains Use Strict Directive which appears at the end of the contains Use Strict Directive which appears at the end of the
block(setter) block(setter)
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
var data; var data;
@ -23,6 +21,5 @@ function testcase() {
} }
}); });
obj.accProperty = "overrideData"; obj.accProperty = "overrideData";
return data==="overrideData";
} assert.sameValue(data, "overrideData", 'data');
runTestCase(testcase);

View File

@ -7,13 +7,11 @@ description: >
Strict Mode - The built-in Function constructor is contained in Strict Mode - The built-in Function constructor is contained in
use strict code use strict code
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
"use strict"; "use strict";
var funObj = new Function("a", "eval('public = 1;');"); var funObj = new Function("a", "eval('public = 1;');");
funObj(); funObj();
return true;
} }
runTestCase(testcase); testcase();

View File

@ -7,13 +7,12 @@ description: >
Strict Mode - Use Strict Directive Prologue is '' use strict';' Strict Mode - Use Strict Directive Prologue is '' use strict';'
which the first character is space which the first character is space
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
" use strict"; " use strict";
var public = 1; var public = 1;
return public === 1; assert.sameValue(public, 1);
} }
runTestCase(testcase); testcase();

View File

@ -8,12 +8,11 @@ description: >
contains Use Strict Directive which appears in the middle of the contains Use Strict Directive which appears in the middle of the
block block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var funObj = new Function("a", "eval('public = 1;'); 'use strict'; anotherVariable = 2;"); var funObj = new Function("a", "eval('public = 1;'); 'use strict'; anotherVariable = 2;");
funObj(); funObj();
return public === 1 && anotherVariable === 2;
} assert.sameValue(public, 1, 'public');
runTestCase(testcase); assert.sameValue(anotherVariable, 2, 'anotherVariable');

View File

@ -7,12 +7,11 @@ description: >
Strict Mode - Function code of built-in Function constructor Strict Mode - Function code of built-in Function constructor
contains Use Strict Directive which appears at the end of the block contains Use Strict Directive which appears at the end of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var funObj = new Function("a", "eval('public = 1;'); anotherVariable = 2; 'use strict';"); var funObj = new Function("a", "eval('public = 1;'); anotherVariable = 2; 'use strict';");
funObj(); funObj();
return public === 1 && anotherVariable === 2;
} assert.sameValue(public, 1, 'public');
runTestCase(testcase); assert.sameValue(anotherVariable, 2, 'anotherVariable');

View File

@ -7,12 +7,12 @@ description: >
Strict Mode - Use Strict Directive Prologue is ''use strict ';' Strict Mode - Use Strict Directive Prologue is ''use strict ';'
which the last character is space which the last character is space
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
"use strict "; "use strict ";
var public = 1; var public = 1;
return public === 1;
assert.sameValue(public, 1);
} }
runTestCase(testcase); testcase();

View File

@ -7,17 +7,10 @@ description: >
Strict Mode - Use Strict Directive Prologue is ''use strict';' Strict Mode - Use Strict Directive Prologue is ''use strict';'
which appears at the beginning of the block which appears at the beginning of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(SyntaxError, function() {
"use strict"; "use strict";
try {
eval("var public = 1;");
return false;
} catch (e) {
return e instanceof SyntaxError;
}
} eval("var public = 1;");
runTestCase(testcase); });

View File

@ -7,13 +7,14 @@ description: >
Strict Mode - Use Strict Directive Prologue is ''use strict';' Strict Mode - Use Strict Directive Prologue is ''use strict';'
which appears in the middle of the block which appears in the middle of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var interface = 2; var interface = 2;
"use strict"; "use strict";
var public = 1; var public = 1;
return public === 1 && interface === 2;
assert.sameValue(public, 1, 'public');
assert.sameValue(interface, 2, 'interface');
} }
runTestCase(testcase); testcase();

View File

@ -7,12 +7,11 @@ description: >
Strict Mode - Use Strict Directive Prologue is ''use strict';' Strict Mode - Use Strict Directive Prologue is ''use strict';'
which appears at the end of the block which appears at the end of the block
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var public = 1; var public = 1;
return public === 1; assert.sameValue(public, 1);
"use strict"; "use strict";
} }
runTestCase(testcase); testcase();

View File

@ -7,17 +7,11 @@ description: >
Strict Mode - Use Strict Directive Prologue is ''use strict';' Strict Mode - Use Strict Directive Prologue is ''use strict';'
which appears twice in the directive prologue which appears twice in the directive prologue
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.throws(SyntaxError, function() {
"use strict"; "use strict";
"use strict"; "use strict";
try {
eval("var public = 1;"); eval("var public = 1;");
return false; });
} catch (e) {
return e instanceof SyntaxError;
}
}
runTestCase(testcase);

View File

@ -7,12 +7,11 @@ description: >
Strict Mode - Use Strict Directive Prologue is ''Use strict';' in Strict Mode - Use Strict Directive Prologue is ''Use strict';' in
which the first character is uppercase which the first character is uppercase
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
"Use strict"; "Use strict";
var public = 1; var public = 1;
return public === 1; assert.sameValue(public, 1);
} }
runTestCase(testcase); testcase();

View File

@ -5,17 +5,12 @@
es5id: 14.1-1-s es5id: 14.1-1-s
description: "'use strict' directive - correct usage" description: "'use strict' directive - correct usage"
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
'use strict'; 'use strict';
return(this === undefined); return(this === undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -5,11 +5,8 @@
es5id: 14.1-10-s es5id: 14.1-10-s
description: other directives - may follow 'use strict' directive description: other directives - may follow 'use strict' directive
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
"use strict"; "use strict";
@ -17,6 +14,4 @@ function testcase() {
return (this === undefined); return (this === undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -5,11 +5,8 @@
es5id: 14.1-11-s es5id: 14.1-11-s
description: comments may preceed 'use strict' directive description: comments may preceed 'use strict' directive
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
// comment // comment
@ -19,6 +16,4 @@ function testcase() {
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -5,11 +5,8 @@
es5id: 14.1-12-s es5id: 14.1-12-s
description: comments may follow 'use strict' directive description: comments may follow 'use strict' directive
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
"use strict"; /* comment */ // comment "use strict"; /* comment */ // comment
@ -17,6 +14,4 @@ function testcase() {
return (this === undefined); return (this === undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -5,17 +5,12 @@
es5id: 14.1-13-s es5id: 14.1-13-s
description: semicolon insertion works for'use strict' directive description: semicolon insertion works for'use strict' directive
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
"use strict" "use strict"
return (this === undefined); return (this === undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -5,11 +5,8 @@
es5id: 14.1-14-s es5id: 14.1-14-s
description: semicolon insertion may come before 'use strict' directive description: semicolon insertion may come before 'use strict' directive
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
"another directive" "another directive"
@ -17,6 +14,4 @@ function testcase() {
return (this === undefined); return (this === undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -5,11 +5,8 @@
es5id: 14.1-15-s es5id: 14.1-15-s
description: blank lines may come before 'use strict' directive description: blank lines may come before 'use strict' directive
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
@ -22,6 +19,4 @@ function testcase() {
return (this === undefined); return (this === undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -7,17 +7,12 @@ description: >
'use strict' directive - not recognized if it follow an empty 'use strict' directive - not recognized if it follow an empty
statement statement
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
; 'use strict'; ; 'use strict';
return (this !== undefined); return (this !== undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
'use strict' directive - not recognized if it follow some other 'use strict' directive - not recognized if it follow some other
statment empty statement statment empty statement
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
var x; var x;
@ -19,6 +16,4 @@ function testcase() {
return (this !== undefined); return (this !== undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -5,17 +5,12 @@
es5id: 14.1-2-s es5id: 14.1-2-s
description: "\"use strict\" directive - correct usage double quotes" description: "\"use strict\" directive - correct usage double quotes"
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
"use strict"; "use strict";
return (this === undefined); return (this === undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -7,17 +7,12 @@ description: >
'use strict' directive - not recognized if it contains extra 'use strict' directive - not recognized if it contains extra
whitespace whitespace
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
' use strict '; ' use strict ';
return (this !== undefined); return (this !== undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -7,11 +7,8 @@ description: >
'use strict' directive - not recognized if contains Line 'use strict' directive - not recognized if contains Line
Continuation Continuation
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
'use str\ 'use str\
@ -19,6 +16,4 @@ ict';
return (this !== undefined); return (this !== undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -7,17 +7,12 @@ description: >
'use strict' directive - not recognized if contains a 'use strict' directive - not recognized if contains a
EscapeSequence EscapeSequence
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
'use\u0020strict'; 'use\u0020strict';
return(this !== undefined); return(this !== undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -7,17 +7,12 @@ description: >
'use strict' directive - not recognized if contains a <TAB> 'use strict' directive - not recognized if contains a <TAB>
instead of a space instead of a space
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
'use strict'; 'use strict';
return (this !== undefined); return (this !== undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -5,17 +5,12 @@
es5id: 14.1-7-s es5id: 14.1-7-s
description: "'use strict' directive - not recognized if upper case" description: "'use strict' directive - not recognized if upper case"
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
'Use Strict'; 'Use Strict';
return (this !== undefined); return (this !== undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -5,11 +5,8 @@
es5id: 14.1-8-s es5id: 14.1-8-s
description: "'use strict' directive - may follow other directives" description: "'use strict' directive - may follow other directives"
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
"bogus directive"; "bogus directive";
@ -17,6 +14,4 @@ function testcase() {
return (this === undefined); return (this === undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -5,11 +5,8 @@
es5id: 14.1-9-s es5id: 14.1-9-s
description: "'use strict' directive - may occur multiple times" description: "'use strict' directive - may occur multiple times"
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() function foo()
{ {
'use strict'; 'use strict';
@ -17,6 +14,4 @@ function testcase() {
return (this === undefined); return (this === undefined);
} }
return foo.call(undefined); assert(foo.call(undefined));
}
runTestCase(testcase);

View File

@ -4,17 +4,13 @@
/*--- /*---
es5id: 10.4.2-1-1 es5id: 10.4.2-1-1
description: Indirect call to eval has context set to global context description: Indirect call to eval has context set to global context
includes: [runTestCase.js]
---*/ ---*/
var __10_4_2_1_1_1 = "str"; var __10_4_2_1_1_1 = "str";
function testcase() { function testcase() {
var _eval = eval; var _eval = eval;
var __10_4_2_1_1_1 = "str1"; var __10_4_2_1_1_1 = "str1";
if(_eval("\'str\' === __10_4_2_1_1_1") === true && // indirect eval assert(_eval("\'str\' === __10_4_2_1_1_1"), 'indirect eval');
eval("\'str1\' === __10_4_2_1_1_1") === true) { // direct eval assert(eval("\'str1\' === __10_4_2_1_1_1"), 'direct eval');
return true;
} }
return false; testcase();
}
runTestCase(testcase);

View File

@ -6,7 +6,6 @@ es5id: 10.4.2-1-2
description: > description: >
Indirect call to eval has context set to global context (nested Indirect call to eval has context set to global context (nested
function) function)
includes: [runTestCase.js]
---*/ ---*/
var __10_4_2_1_2 = "str"; var __10_4_2_1_2 = "str";
@ -15,13 +14,9 @@ function testcase() {
var __10_4_2_1_2 = "str1"; var __10_4_2_1_2 = "str1";
function foo() { function foo() {
var __10_4_2_1_2 = "str2"; var __10_4_2_1_2 = "str2";
if(_eval("\'str\' === __10_4_2_1_2") === true && // indirect eval assert(_eval("\'str\' === __10_4_2_1_2"), 'indirect eval');
eval("\'str2\' === __10_4_2_1_2") === true) { // direct eval assert(eval("\'str2\' === __10_4_2_1_2"), 'direct eval');
return true;
} else {
return false;
} }
foo();
} }
return foo(); testcase();
}
runTestCase(testcase);

View File

@ -6,7 +6,6 @@ es5id: 10.4.2-1-3
description: > description: >
Indirect call to eval has context set to global context (catch Indirect call to eval has context set to global context (catch
block) block)
includes: [runTestCase.js]
---*/ ---*/
var __10_4_2_1_3 = "str"; var __10_4_2_1_3 = "str";
@ -18,12 +17,8 @@ function testcase() {
} }
catch (e) { catch (e) {
var __10_4_2_1_3 = "str2"; var __10_4_2_1_3 = "str2";
if (_eval("\'str\' === __10_4_2_1_3") === true && // indirect eval assert(_eval("\'str\' === __10_4_2_1_3"), 'indirect eval');
eval("\'str2\' === __10_4_2_1_3") === true) { // direct eval assert(eval("\'str2\' === __10_4_2_1_3"), 'direct eval');
return true;
} else {
return false;
} }
} }
} testcase();
runTestCase(testcase);

View File

@ -7,7 +7,6 @@ description: >
Indirect call to eval has context set to global context (with Indirect call to eval has context set to global context (with
block) block)
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
var __10_4_2_1_4 = "str"; var __10_4_2_1_4 = "str";
@ -17,11 +16,8 @@ function testcase() {
var _eval = eval; var _eval = eval;
var __10_4_2_1_4 = "str1"; var __10_4_2_1_4 = "str1";
with (o) { with (o) {
if (_eval("\'str\' === __10_4_2_1_4") === true && // indirect eval assert(_eval("\'str\' === __10_4_2_1_4"), 'indirect eval');
eval("\'str2\' === __10_4_2_1_4") === true) { // direct eval assert(eval("\'str2\' === __10_4_2_1_4"), 'direct eval');
return true;
} }
} }
return false; testcase();
}
runTestCase(testcase);

View File

@ -6,7 +6,6 @@ es5id: 10.4.2-1-5
description: > description: >
Indirect call to eval has context set to global context (inside Indirect call to eval has context set to global context (inside
another eval) another eval)
includes: [runTestCase.js]
---*/ ---*/
var __10_4_2_1_5 = "str"; var __10_4_2_1_5 = "str";
@ -18,6 +17,6 @@ function testcase() {
_eval(\"\'str\' === __10_4_2_1_5 \") && \ _eval(\"\'str\' === __10_4_2_1_5 \") && \
eval(\"\'str2\' === __10_4_2_1_5\")\ eval(\"\'str2\' === __10_4_2_1_5\")\
"); ");
return r; assert(r);
} }
runTestCase(testcase); testcase();

View File

@ -7,15 +7,14 @@ description: >
Direct val code in non-strict mode - can instantiate variable in Direct val code in non-strict mode - can instantiate variable in
calling context calling context
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var x = 0; var x = 0;
return function inner() { function inner() {
eval("var x = 1"); eval("var x = 1");
if (x === 1) assert.sameValue(x, 1, "x");
return true;
} ();
} }
runTestCase(testcase); inner();
}
testcase();

View File

@ -7,11 +7,10 @@ description: >
Strict Mode - Strict mode eval code cannot instantiate functions Strict Mode - Strict mode eval code cannot instantiate functions
in the variable environment of the caller to eval in the variable environment of the caller to eval
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
eval("function fun(x){ return x }"); eval("function fun(x){ return x }");
return typeof (fun) === "undefined"; assert.sameValue(typeof (fun), "undefined");
} }
runTestCase(testcase); testcase();

View File

@ -6,15 +6,14 @@ es5id: 10.4.2-3-c-1-s
description: > description: >
Direct eval code in strict mode - cannot instantiate variable in Direct eval code in strict mode - cannot instantiate variable in
the variable environment of the calling context the variable environment of the calling context
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var _10_4_2_3_c_1_s = 0; var _10_4_2_3_c_1_s = 0;
function _10_4_2_3_c_1_sFunc() { function _10_4_2_3_c_1_sFunc() {
eval("'use strict';var _10_4_2_3_c_1_s = 1"); eval("'use strict';var _10_4_2_3_c_1_s = 1");
return _10_4_2_3_c_1_s===0; assert.sameValue(_10_4_2_3_c_1_s, 0);
} }
return _10_4_2_3_c_1_sFunc(); _10_4_2_3_c_1_sFunc();
} }
runTestCase(testcase); testcase();

View File

@ -7,15 +7,14 @@ description: >
Calling code in strict mode - eval cannot instantiate variable in Calling code in strict mode - eval cannot instantiate variable in
the variable environment of the calling context the variable environment of the calling context
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var _10_4_2_3_c_2_s = 0; var _10_4_2_3_c_2_s = 0;
function _10_4_2_3_c_2_sFunc() { function _10_4_2_3_c_2_sFunc() {
eval("var _10_4_2_3_c_2_s = 1"); eval("var _10_4_2_3_c_2_s = 1");
return _10_4_2_3_c_2_s===0; assert.sameValue(_10_4_2_3_c_2_s, 0);
} }
return _10_4_2_3_c_2_sFunc(); _10_4_2_3_c_2_sFunc();
} }
runTestCase(testcase); testcase();

View File

@ -7,15 +7,11 @@ description: >
Calling code in strict mode - eval cannot instantiate variable in Calling code in strict mode - eval cannot instantiate variable in
the global context the global context
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
var _10_4_2_3_c_3_s = 0; var _10_4_2_3_c_3_s = 0;
function testcase() { function testcase() {
function _10_4_2_3_c_3_sFunc() {
eval("var _10_4_2_3_c_3_s = 1"); eval("var _10_4_2_3_c_3_s = 1");
return _10_4_2_3_c_3_s===0; assert.sameValue(_10_4_2_3_c_3_s, 0);
} }
return _10_4_2_3_c_3_sFunc(); testcase();
}
runTestCase(testcase);

View File

@ -7,11 +7,10 @@ description: >
Strict Mode - Strict mode eval code cannot instantiate functions Strict Mode - Strict mode eval code cannot instantiate functions
in the variable environment of the caller to eval in the variable environment of the caller to eval
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
eval("function _10_4_2_1_2_fun(){}"); eval("function _10_4_2_1_2_fun(){}");
return typeof _10_4_2_1_2_fun === "undefined"; assert.sameValue(typeof _10_4_2_1_2_fun, "undefined");
} }
runTestCase(testcase); testcase();

View File

@ -6,11 +6,10 @@ es5id: 10.4.2.1-4-s
description: > description: >
Strict Mode - Strict mode eval code cannot instantiate functions Strict Mode - Strict mode eval code cannot instantiate functions
in the variable environment of the caller to eval. in the variable environment of the caller to eval.
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
eval("'use strict'; function _10_4_2_1_4_fun(){}"); eval("'use strict'; function _10_4_2_1_4_fun(){}");
return typeof _10_4_2_1_4_fun === "undefined"; assert.sameValue(typeof _10_4_2_1_4_fun, "undefined");
} }
runTestCase(testcase); testcase();

View File

@ -8,24 +8,17 @@ description: >
simple assignment creates property on the global object if simple assignment creates property on the global object if
LeftHandSide is an unresolvable reference LeftHandSide is an unresolvable reference
flags: [noStrict] flags: [noStrict]
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
function foo() { function foo() {
__ES3_1_test_suite_test_11_13_1_unique_id_3__ = 42; __ES3_1_test_suite_test_11_13_1_unique_id_3__ = 42;
} }
foo(); foo();
var desc = Object.getOwnPropertyDescriptor(fnGlobalObject(), '__ES3_1_test_suite_test_11_13_1_unique_id_3__'); var desc = Object.getOwnPropertyDescriptor(fnGlobalObject(), '__ES3_1_test_suite_test_11_13_1_unique_id_3__');
if (desc.value === 42 &&
desc.writable === true && assert.sameValue(desc.value, 42, 'desc.value');
desc.enumerable === true && assert.sameValue(desc.writable, true, 'desc.writable');
desc.configurable === true) { assert.sameValue(desc.enumerable, true, 'desc.enumerable');
delete __ES3_1_test_suite_test_11_13_1_unique_id_3__; assert.sameValue(desc.configurable, true, 'desc.configurable');
return true;
}
}
runTestCase(testcase);

View File

@ -6,20 +6,10 @@ es5id: 11.13.1-4-27-s
description: > description: >
simple assignment throws TypeError if LeftHandSide is a readonly simple assignment throws TypeError if LeftHandSide is a readonly
property in strict mode (Global.undefined) property in strict mode (Global.undefined)
includes: flags: [onlyStrict]
- runTestCase.js includes: [fnGlobalObject.js]
- fnGlobalObject.js
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
'use strict';
try {
fnGlobalObject().undefined = 42; fnGlobalObject().undefined = 42;
return false; });
}
catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -8,16 +8,17 @@ description: >
appears as the LeftHandSideExpression of simple assignment(=) appears as the LeftHandSideExpression of simple assignment(=)
under strict mode under strict mode
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = eval; var blah = eval;
try { try {
eval("var eval = 20;"); eval("var eval = 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === eval; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, eval, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appears as the LeftHandSideExpression of simple assignment(=) appears as the LeftHandSideExpression of simple assignment(=)
under strict mode under strict mode
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("var arguments = 20;"); eval("var arguments = 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appears as the LeftHandSideExpression (PrimaryExpression) of appears as the LeftHandSideExpression (PrimaryExpression) of
simple assignment(=) under strict mode simple assignment(=) under strict mode
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("(arguments) = 20;"); eval("(arguments) = 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -6,15 +6,11 @@ es5id: 8.12.5-3-b_1
description: > description: >
Changing the value of a data property should not affect it's Changing the value of a data property should not affect it's
non-value property descriptor attributes. non-value property descriptor attributes.
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var origReduce = Array.prototype.reduce;
var origDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce"); var origDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce");
var newDesc; var newDesc;
try {
Array.prototype.reduce = function () {;}; Array.prototype.reduce = function () {;};
newDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce"); newDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce");
var descArray = [origDesc, newDesc]; var descArray = [origDesc, newDesc];
@ -22,19 +18,10 @@ function testcase() {
for (var j in descArray) { //Ensure no attributes are magically added to newDesc for (var j in descArray) { //Ensure no attributes are magically added to newDesc
for (var i in descArray[j]) { for (var i in descArray[j]) {
if (i==="value") { if (i==="value") {
if (origDesc[i]===newDesc[i]) { assert.notSameValue(origDesc[i], newDesc[i], 'origDesc[i]');
return false;
} }
} else {
else if (origDesc[i]!==newDesc[i]) { assert.sameValue(origDesc[i], newDesc[i], 'origDesc[i]');
return false;
} }
} }
} }
return true;
} finally {
Array.prototype.reduce = origReduce;
}
}
runTestCase(testcase);

View File

@ -6,19 +6,15 @@ es5id: 8.12.5-3-b_2
description: > description: >
Changing the value of a data property should not affect it's Changing the value of a data property should not affect it's
non-value property descriptor attributes. non-value property descriptor attributes.
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var tempObj = {}; var tempObj = {};
Object.defineProperty(tempObj, "reduce", { value:456, enumerable:false, writable:true}); Object.defineProperty(tempObj, "reduce", { value:456, enumerable:false, writable:true});
var origReduce = tempObj.reduce;
var origDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce"); var origDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce");
var newDesc; var newDesc;
try {
tempObj.reduce = 123; tempObj.reduce = 123;
newDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce"); newDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce");
var descArray = [origDesc, newDesc]; var descArray = [origDesc, newDesc];
@ -26,19 +22,10 @@ function testcase() {
for (var j in descArray) { for (var j in descArray) {
for (var i in descArray[j]) { for (var i in descArray[j]) {
if (i==="value") { if (i==="value") {
if (origDesc[i]===newDesc[i]) { assert.notSameValue(origDesc[i], newDesc[i], 'origDesc[i]');
return false;
} }
} else {
else if (origDesc[i]!==newDesc[i]) { assert.sameValue(origDesc[i], newDesc[i], 'origDesc[i]');
return false;
} }
} }
} }
return true;
} finally {
tempObj.reduce = origReduce;
}
}
runTestCase(testcase);

View File

@ -6,34 +6,23 @@ es5id: 8.12.5-5-b_1
description: > description: >
Changing the value of an accessor property should not affect it's Changing the value of an accessor property should not affect it's
property descriptor attributes. property descriptor attributes.
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var tempObj = {}; var tempObj = {};
Object.defineProperty(tempObj, "reduce", { get: function() {return 456;}, enumerable:false, set: function() {;}}); Object.defineProperty(tempObj, "reduce", { get: function() {return 456;}, enumerable:false, set: function() {;}});
var origReduce = tempObj.reduce;
var origDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce"); var origDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce");
var newDesc; var newDesc;
try {
tempObj.reduce = 123; tempObj.reduce = 123;
newDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce"); newDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce");
var descArray = [origDesc, newDesc]; var descArray = [origDesc, newDesc];
for (var j in descArray) { for (var j in descArray) {
for (var i in descArray[j]) { for (var i in descArray[j]) {
if (origDesc[i]!==newDesc[i]) { assert.sameValue(origDesc[i], newDesc[i], 'origDesc[i]');
return false;
} }
} }
}
return tempObj.reduce===456;
} finally { assert.sameValue(tempObj.reduce, 456, 'tempObj.reduce');
tempObj.reduce = origReduce;
}
}
runTestCase(testcase);

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(*=) operator(*=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments *= 20;"); eval("arguments *= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(/=) operator(/=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments /= 20;"); eval("arguments /= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(%=) operator(%=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments %= 20;"); eval("arguments %= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(+=) operator(+=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments += 20;"); eval("arguments += 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(-=) operator(-=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments -= 20;"); eval("arguments -= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(<<=) operator(<<=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments <<= 20;"); eval("arguments <<= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(>>=) operator(>>=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments >>= 20;"); eval("arguments >>= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(>>>=) operator(>>>=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments >>>= 20;"); eval("arguments >>>= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(&=) operator(&=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments &= 20;"); eval("arguments &= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(^=) operator(^=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments ^= 20;"); eval("arguments ^= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(|=) operator(|=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments |= 20;"); eval("arguments |= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,7 +8,6 @@ info: >
es5id: 11.4.1-0-1 es5id: 11.4.1-0-1
description: delete operator as UnaryExpression description: delete operator as UnaryExpression
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
@ -16,10 +15,7 @@ function testcase() {
var y = 2; var y = 2;
var z = 3; var z = 3;
if( (!delete x || delete y) && assert((!delete x || delete y), '(!delete x || delete y)');
delete delete z) assert(delete delete z, 'delete delete z');
{
return true;
} }
} testcase();
runTestCase(testcase);

View File

@ -10,7 +10,6 @@ description: >
delete operator returns true on deleting arguments delete operator returns true on deleting arguments
propterties(arguments.callee) propterties(arguments.callee)
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
@ -19,7 +18,8 @@ function testcase() {
return (delete arguments.callee); return (delete arguments.callee);
} }
var d = delete arguments.callee; var d = delete arguments.callee;
if(d === true && arguments.callee === undefined)
return true; assert.sameValue(d, true, 'd');
assert.sameValue(arguments.callee, undefined, 'arguments.callee');
} }
runTestCase(testcase); testcase();

View File

@ -8,7 +8,6 @@ info: >
es5id: 11.4.1-4.a-13 es5id: 11.4.1-4.a-13
description: delete operator returns false when deleting Array object description: delete operator returns false when deleting Array object
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
@ -18,7 +17,7 @@ function testcase() {
var d = delete a var d = delete a
if(d === false && Array.isArray(a) === true) assert.sameValue(d, false, 'd');
return true; assert.sameValue(Array.isArray(a), true, 'Array.isArray(a)');
} }
runTestCase(testcase); testcase();

View File

@ -8,12 +8,10 @@ info: >
es5id: 11.4.1-4.a-16 es5id: 11.4.1-4.a-16
description: delete operator returns false on deleting arguments object description: delete operator returns false on deleting arguments object
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
assert.sameValue(delete arguments, false, 'delete arguments');
if(delete arguments === false && arguments !== undefined) assert.notSameValue(arguments, undefined, 'arguments');
return true;
} }
runTestCase(testcase); testcase();

View File

@ -10,7 +10,6 @@ description: >
delete operator returns false when deleting the declaration of the environment object delete operator returns false when deleting the declaration of the environment object
inside 'with' inside 'with'
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
@ -21,9 +20,9 @@ function testcase() {
{ {
d = delete o; d = delete o;
} }
if (d === false && typeof(o) === 'object' && o.x === 1) {
return true; assert.sameValue(d, false, 'd');
assert.sameValue(typeof(o), 'object', 'typeof(o)');
assert.sameValue(o.x, 1, 'o.x');
} }
return false; testcase();
}
runTestCase(testcase);

View File

@ -8,15 +8,13 @@ info: >
es5id: 11.4.1-4.a-7 es5id: 11.4.1-4.a-7
description: delete operator inside 'eval' description: delete operator inside 'eval'
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var x = 1; var x = 1;
var d = eval("delete x"); var d = eval("delete x");
if (d === false && x === 1) {
return true; assert.sameValue(d, false, 'd');
assert.sameValue(x, 1, 'x');
} }
return false; testcase();
}
runTestCase(testcase);

View File

@ -7,7 +7,6 @@ description: >
delete operator returns false when deleting a direct reference to delete operator returns false when deleting a direct reference to
a var a var
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
@ -15,7 +14,8 @@ function testcase() {
// Now, deleting 'x' directly should fail; // Now, deleting 'x' directly should fail;
var d = delete x; var d = delete x;
if(d === false && x === 1)
return true; assert.sameValue(d, false, 'd');
assert.sameValue(x, 1, 'x');
} }
runTestCase(testcase); testcase();

View File

@ -7,8 +7,6 @@ description: >
delete operator returns false when deleting a direct reference to delete operator returns false when deleting a direct reference to
a function name a function name
flags: [noStrict] flags: [noStrict]
includes:
- runTestCase.js
---*/ ---*/
function testcase() { function testcase() {
@ -16,7 +14,8 @@ function testcase() {
// Now, deleting 'foo' directly should fail; // Now, deleting 'foo' directly should fail;
var d = delete foo; var d = delete foo;
if(d === false && typeof foo === 'function')
return true; assert.sameValue(d, false, 'd');
assert.sameValue(typeof foo, 'function', 'typeof foo');
} }
runTestCase(testcase); testcase();

Some files were not shown because too many files have changed in this diff Show More