mirror of https://github.com/tc39/test262.git
Replace runTestCase with assert helpers [test/language/directive-prologue]
This commit is contained in:
parent
789224fbaa
commit
8447a55e49
|
@ -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();
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
} ();
|
|
||||||
}
|
}
|
||||||
runTestCase(testcase);
|
testcase();
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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() {
|
var data = "data";
|
||||||
|
|
||||||
|
assert.throws(SyntaxError, function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
try {
|
|
||||||
var obj = {};
|
var obj = {};
|
||||||
var data = "data";
|
|
||||||
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);
|
|
||||||
|
|
|
@ -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() {
|
||||||
runTestCase(testcase);
|
fun();
|
||||||
|
});
|
||||||
|
|
|
@ -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);
|
});
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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() {
|
var data = "data";
|
||||||
try {
|
|
||||||
|
assert.throws(SyntaxError, function() {
|
||||||
var obj = {};
|
var obj = {};
|
||||||
var data = "data";
|
|
||||||
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);
|
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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);
|
});
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
|
@ -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);
|
|
||||||
|
|
Loading…
Reference in New Issue