Update handling of directive prologues

Some tests specifically concern the application of the `use strict`
directive as it appears in JavaScript source code. These tests should
*not* be run with the `onlyStrict` flag because relying on the test
runner to enable strict mode makes the semantics of the source code
irrelevant. Update these tests to use the `noStrict` flag.

Other tests concern language semantics that are only valid in strict
mode, but the mechanism for enabling strictness is inconseqential.
Update these tests to use the `onlyStrict` flag and remove any redundant
`use strict` directive prologues contained within.

Still other tests are valid both within and outside of strict mode.
In keeping with the majority of other tests, do not specify any
restrictions on the environments in which these tests may be run.
This commit is contained in:
Mike Pennisi 2015-06-08 17:35:11 -04:00
parent 6231fe20a4
commit 29ecced632
636 changed files with 313 additions and 1012 deletions

View File

@ -7,7 +7,7 @@
/*---
es5id: 15.4.4.16-5-1-s
description: Array.prototype.every - thisArg not passed to strict callbackfn
flags: [onlyStrict]
flags: [noStrict]
includes: [runTestCase.js]
---*/

View File

@ -7,7 +7,7 @@
/*---
es5id: 15.4.4.20-5-1-s
description: Array.prototype.filter - thisArg not passed to strict callbackfn
flags: [onlyStrict]
flags: [noStrict]
includes: [runTestCase.js]
---*/

View File

@ -8,6 +8,6 @@ description: >
flags: [onlyStrict]
---*/
var a = [];
[1, 2].findIndex(function() { "use strict"; a.push(this); }, "");
[1, 2].findIndex(function() { a.push(this); }, "");
assert.sameValue(a[0], "");
assert.sameValue(a[1], a[0]);

View File

@ -7,7 +7,7 @@
/*---
es5id: 15.4.4.18-5-1-s
description: Array.prototype.forEach - thisArg not passed to strict callbackfn
flags: [onlyStrict]
flags: [noStrict]
includes: [runTestCase.js]
---*/

View File

@ -7,7 +7,7 @@
/*---
es5id: 15.4.4.19-5-1-s
description: Array.prototype.map - thisArg not passed to strict callbackfn
flags: [onlyStrict]
flags: [noStrict]
includes: [runTestCase.js]
---*/

View File

@ -9,7 +9,7 @@ es5id: 15.4.4.21-9-c-ii-4-s
description: >
Array.prototype.reduce - undefined passed as thisValue to strict
callbackfn
flags: [onlyStrict]
flags: [noStrict]
includes: [runTestCase.js]
---*/

View File

@ -9,7 +9,7 @@ es5id: 15.4.4.22-9-c-ii-4-s
description: >
Array.prototype.reduceRight - undefined passed as thisValue to
strict callbackfn
flags: [onlyStrict]
flags: [noStrict]
includes: [runTestCase.js]
---*/

View File

@ -7,7 +7,7 @@
/*---
es5id: 15.4.4.17-5-1-s
description: Array.prototype.some - thisArg not passed to strict callbackfn
flags: [onlyStrict]
flags: [noStrict]
includes: [runTestCase.js]
---*/

View File

@ -5,7 +5,7 @@
info: Call the comparefn passing undefined as the this value (step 13b)
es5id: 15.4.4.11_A8
description: comparefn tests that its this value is undefined
flags: [onlyStrict]
flags: [noStrict]
---*/
var global = this;

View File

@ -10,7 +10,7 @@ description: >
Strict Mode - SyntaxError is thrown if a function using the
Function constructor has two identical parameters in (local)
strict mode
flags: [onlyStrict]
flags: [noStrict]
---*/
assert.throws(SyntaxError, function() {

View File

@ -9,7 +9,7 @@ es5id: 15.3.2.1-11-1-s
description: >
Duplicate seperate parameter name in Function constructor throws
SyntaxError in strict mode
flags: [onlyStrict]
flags: [noStrict]
includes: [runTestCase.js]
---*/

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
function testcase()
{
"use strict";
try {
Function('a','a','return;');
return true;

View File

@ -9,7 +9,7 @@ es5id: 15.3.2.1-11-3-s
description: >
Function constructor having a formal parameter named 'eval' throws
SyntaxError if function body is strict mode
flags: [onlyStrict]
flags: [noStrict]
includes: [runTestCase.js]
---*/

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
try {
Function('eval', 'return;');
return true;

View File

@ -9,7 +9,7 @@ es5id: 15.3.2.1-11-5-s
description: >
Duplicate combined parameter name in Function constructor throws
SyntaxError in strict mode
flags: [onlyStrict]
flags: [noStrict]
includes: [runTestCase.js]
---*/

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
function testcase()
{
"use strict";
try {
Function('a,a','return a;');
return true;

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
try {
Function('arguments', 'return;');
return true;

View File

@ -16,7 +16,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var foo = new Function("baz", "qux", "baz", "return 0;");
return true;

View File

@ -11,13 +11,10 @@ description: >
the Function constructor that has three identical parameters and
there is no explicit 'use strict' in the function constructor's
body
flags: [onlyStrict]
includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var foo = new Function("baz", "baz", "baz", "return 0;");
return true;
}

View File

@ -12,6 +12,7 @@ description: >
flags: [onlyStrict]
---*/
"use strict";
function _15_3_5_1_gs() {}
assert.throws(TypeError, function() {

View File

@ -13,7 +13,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
function _15_3_5_1_gs() {}
_15_3_5_1_gs.caller;
throw NotEarlyError;

View File

@ -13,7 +13,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
eval("gNonStrict();");

View File

@ -13,7 +13,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var my_eval = eval;
my_eval("gNonStrict();");

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
function f() {
return gNonStrict();
}

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var f = function () {
return gNonStrict();
}

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var obj = new (function () {
return gNonStrict();
});

View File

@ -13,7 +13,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
function f() {
return gNonStrict();
}

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
function f1() {
function f() {
return gNonStrict();

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
function f1() {
var f = function () {
return gNonStrict();

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
function f1() {
return (function () {
return gNonStrict();

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var f1 = function () {
function f() {
return gNonStrict();

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var f1 = function () {
var f = function () {
return gNonStrict();

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var f1 = function () {
return (function () {
return gNonStrict();

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
(function () {
function f() {
return gNonStrict();

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
(function () {
var f = function () {
return gNonStrict();

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
(function () {
return (function () {
return gNonStrict();

View File

@ -13,7 +13,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var f = function () {
return gNonStrict();
}

View File

@ -13,7 +13,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var o = { get foo() { return gNonStrict(); } }
o.foo;

View File

@ -13,7 +13,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var o = { set foo(stuff) { return gNonStrict(); } }
o.foo = 7;

View File

@ -13,7 +13,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var o = {};
Object.defineProperty(o, "foo", { get: function() { return gNonStrict(); } });
o.foo;

View File

@ -13,7 +13,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var o = {};
Object.defineProperty(o, "foo", { set: function(stuff) { return gNonStrict(); } });
o.foo = 9;

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
(function () {
return gNonStrict();
})();

View File

@ -13,7 +13,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var f = Function("return gNonStrict();");
f();

View File

@ -14,7 +14,6 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
var f = new Function("return gNonStrict();");
f();

View File

@ -15,8 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
function fun() {
return (this instanceof String);
}

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
function fun() {
return (this instanceof Number);
}

View File

@ -15,8 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
function fun() {
return (this instanceof Boolean);
}

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
function fun() {
return (this instanceof String);
}

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
function fun() {
return (this instanceof Number);
}

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
function fun() {
return (this instanceof Boolean);
}

View File

@ -17,8 +17,6 @@ flags: [onlyStrict]
---*/
(function (a, b, c) {
"use strict";
Object.defineProperty(arguments, "0", {
value: 20,
writable: false,

View File

@ -10,10 +10,8 @@ description: >
Check that all the own property names reported by
Object.getOwnPropertyNames on a strict function are names that
hasOwnProperty agrees are own properties.
flags: [onlyStrict]
---*/
"use strict";
function foo() {}
var names = Object.getOwnPropertyNames(foo);

View File

@ -5,7 +5,7 @@
info: Call replaceValue passing undefined as the this value
es5id: 15.5.4.11_A12
description: replaceValue tests that its this value is undefined
flags: [onlyStrict]
flags: [noStrict]
---*/
var global = this;

View File

@ -14,8 +14,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
try {
NaN = 12;
return false;

View File

@ -14,7 +14,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
try {
undefined = 12;
return false;

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var objBak = Object;
try {

View File

@ -15,8 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var numBak = Number;
try {
Number = 12;

View File

@ -6,7 +6,6 @@ description: >
Objects whose specified property is not writable satisfy the assertion in
strict mode.
includes: [propertyHelper.js]
flags: [onlyStrict]
---*/
var obj = {};

View File

@ -6,7 +6,6 @@ description: >
Objects whose specified property is not writable do not satisfy the
assertion in strict mode.
includes: [propertyHelper.js]
flags: [onlyStrict]
---*/
var threw = false;

View File

@ -12,7 +12,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
try {
(function fun() {
eval("arguments = 10");

View File

@ -11,7 +11,6 @@ negative: SyntaxError
flags: [onlyStrict]
---*/
"use strict";
throw NotEarlyError;
function f_10_5_1_gs(){

View File

@ -12,8 +12,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
try {
eval("(function _10_5_7_b_1_fun() { arguments = 10;} ());");
return false;

View File

@ -6,14 +6,11 @@
/*---
es5id: 10.5-7-b-2-s
description: Strict Mode - arguments object index assignment is allowed
flags: [onlyStrict]
description: Arguments object index assignment is allowed
includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
function _10_5_7_b_2_fun() {
arguments[7] = 12;
return arguments[7] === 12;

View File

@ -7,15 +7,11 @@
/*---
es5id: 10.5-7-b-3-s
description: >
Strict Mode - Adding property to the arguments object successful
under strict mode
flags: [onlyStrict]
Adding property to the arguments object successful under strict mode
includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
function _10_5_7_b_3_fun() {
arguments[1] = 12;
return arguments[0] === 30 && arguments[1] === 12;

View File

@ -7,15 +7,11 @@
/*---
es5id: 10.5-7-b-4-s
description: >
Strict Mode - Deleting property of the arguments object successful
under strict mode
flags: [onlyStrict]
Deleting property of the arguments object successful under strict mode
includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
function _10_5_7_b_4_fun() {
var _10_5_7_b_4_1 = arguments[0] === 30 && arguments[1] === 12;
delete arguments[1];

View File

@ -16,7 +16,6 @@ includes: [runTestCase.js]
function testcase() {
function foo(a,b,c)
{
'use strict';
a = 1; b = 'str'; c = 2.1;
return (arguments[0] === 10 && arguments[1] === 'sss' && arguments[2] === 1);
}

View File

@ -15,7 +15,6 @@ function testcase() {
function foo(a,b,c)
{
'use strict';
arguments[0] = 1; arguments[1] = 'str'; arguments[2] = 2.1;
return 10 === a && 'sss' === b && 1 === c;
}

View File

@ -14,7 +14,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
'use strict';
try
{
arguments.caller;

View File

@ -12,8 +12,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
'use strict';
var desc = Object.getOwnPropertyDescriptor(arguments,"caller");
return desc!== undefined;
}

View File

@ -12,8 +12,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
'use strict';
var desc = Object.getOwnPropertyDescriptor(arguments,"caller");
return (desc.configurable === false &&

View File

@ -14,7 +14,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
'use strict';
try
{
arguments.callee;

View File

@ -6,14 +6,11 @@
/*---
es5id: 10.6-13-c-2-s
description: arguments.callee is exists in strict mode
flags: [onlyStrict]
description: arguments.callee is exists
includes: [runTestCase.js]
---*/
function testcase() {
'use strict';
var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
return desc !== undefined;
}

View File

@ -12,8 +12,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
'use strict';
var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
return (desc.configurable === false &&
desc.enumerable === false &&

View File

@ -12,7 +12,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var argObj = function () {
return arguments;
} ();

View File

@ -14,8 +14,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var argObj = function () {
return arguments;
} ();

View File

@ -14,8 +14,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var argObj = function () {
return arguments;
} ();

View File

@ -7,15 +7,11 @@
/*---
es5id: 10.6-14-c-1-s
description: >
Strict Mode - [[Enumerable]] attribute value in 'callee' is false
under strict mode
flags: [onlyStrict]
[[Enumerable]] attribute value in 'callee' is false
includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var argObj = function () {
return arguments;
} ();

View File

@ -14,8 +14,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var argObj = function () {
return arguments;
} ();

View File

@ -12,7 +12,6 @@ description: >
flags: [onlyStrict]
---*/
"use strict";
function f_10_6_1_gs(){
return arguments.callee;
}

View File

@ -13,7 +13,6 @@ negative: .
flags: [onlyStrict]
---*/
"use strict";
function f_10_6_1_gs(){
return arguments.callee;
}

View File

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

View File

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

View File

@ -14,7 +14,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
eval("function fun(x){ return x }");
return typeof (fun) === "undefined";
}

View File

@ -9,7 +9,6 @@ es5id: 10.4.2-3-c-1-s
description: >
Direct eval code in strict mode - cannot instantiate variable in
the variable environment of the calling context
flags: [onlyStrict]
includes: [runTestCase.js]
---*/

View File

@ -16,7 +16,6 @@ includes: [runTestCase.js]
function testcase() {
var _10_4_2_3_c_2_s = 0;
function _10_4_2_3_c_2_sFunc() {
'use strict';
eval("var _10_4_2_3_c_2_s = 1");
return _10_4_2_3_c_2_s===0;
}

View File

@ -16,7 +16,6 @@ includes: [runTestCase.js]
var _10_4_2_3_c_3_s = 0;
function testcase() {
function _10_4_2_3_c_3_sFunc() {
'use strict';
eval("var _10_4_2_3_c_3_s = 1");
return _10_4_2_3_c_3_s===0;
}

View File

@ -14,7 +14,6 @@ negative: ReferenceError
flags: [onlyStrict]
---*/
"use strict";
eval("var x = 7;");
x = 9;
throw NotEarlyError;

View File

@ -14,8 +14,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
eval("function _10_4_2_1_2_fun(){}");
return typeof _10_4_2_1_2_fun === "undefined";
}

View File

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

View File

@ -6,10 +6,8 @@ es5id: 10.4.2.1_A1
description: >
Strict indirect eval should not leak top level declarations into
the global scope
flags: [onlyStrict]
---*/
"use strict";
if (!('foo' in this)) {
(1,eval)('"use strict"; var foo = 88;');
if ('foo' in this) {

View File

@ -9,13 +9,11 @@ info: PutValue operates only on references (see step 3.a).
es5id: 11.13.1-1-6-s
description: >
simple assignment throws ReferenceError if LeftHandSide is an
unresolvable reference in strict mode (base obj undefined)
flags: [onlyStrict]
unresolvable reference (base obj undefined)
includes: [runTestCase.js]
---*/
function testcase() {
'use strict';
try {
__ES3_1_test_suite_test_11_13_1_unique_id_0__.x = 42;

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var obj = {};
Object.defineProperty(obj, "prop", {
value: 10,

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var obj = {};
Object.defineProperty(obj, "prop", {
get: function () {

View File

@ -16,7 +16,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var obj = {};
Object.preventExtensions(obj);

View File

@ -14,8 +14,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
'use strict';
try {
Number.MAX_VALUE = 42;
return false;

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var blah = eval;
try {
eval("var eval = 20;");

View File

@ -13,5 +13,4 @@ negative: TypeError
flags: [onlyStrict]
---*/
"use strict";
Math.PI = 20;

View File

@ -15,7 +15,6 @@ includes: [runTestCase.js]
---*/
function testcase() {
"use strict";
var blah = arguments;
try {
eval("var arguments = 20;");

View File

@ -13,5 +13,4 @@ negative: .
flags: [onlyStrict]
---*/
"use strict";
Math.PI = 20;

View File

@ -16,8 +16,6 @@ includes:
---*/
function testcase() {
'use strict';
try {
fnGlobalObject().Infinity = 42;
return false;

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