mirror of https://github.com/tc39/test262.git
Strict eval variable declarations are lexically scoped, assign expected result value to a previously declared global (issue #35)
Add missing variable declarations (issue #35) Split S12.6.3_A10 and S12.6.3_A10.1 because both files seem to test implicit global variables (issue #35) Changes (issue #35) - Add missing noStrict flags. - Change 13.2-15-1 and 13.2-18-1 to use assert.js and propertyHelper.js (simplifies writable and configurable checks while in strict mode). - Add variable declarations for globals. - Create copies of S13.2.1_A6_T1 and S13.2.1_A6_T2 instead of adding variable declarations, because both files seem to test implicit global variables. - Split S13_A14 and S13_A16 to work in strict mode. - Remove assignment to .name property. Add missing noStrict flags (issue #35) Add missing noStrict flags and variable declarations (issue #35) Add missing noStrict flags (issue #35)
This commit is contained in:
parent
47dcfe8cac
commit
15cc639131
|
@ -11,11 +11,13 @@ description: >
|
|||
Identifier
|
||||
---*/
|
||||
|
||||
var result;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#1
|
||||
try{
|
||||
eval("FOR1 : for(var i=1;i<2;i++){ LABEL1 : do {var x =1;break\u000AFOR1;var y=2;} while(0);}");
|
||||
if (i!==2) {
|
||||
eval("FOR1 : for(var i=1;i<2;i++){ LABEL1 : do {var x =1;break\u000AFOR1;var y=2;} while(0);} result = i;");
|
||||
if (result!==2) {
|
||||
$ERROR('#1: Since LineTerminator(U-000A) between break and Identifier not allowed break evaluates without label');
|
||||
}
|
||||
} catch(e){
|
||||
|
@ -27,8 +29,8 @@ try{
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#2
|
||||
try{
|
||||
eval("FOR2 : for(var i=1;i<2;i++){ LABEL2 : do {var x =1;break\u000DFOR2;var y=2;} while(0);}");
|
||||
if (i!==2) {
|
||||
eval("FOR2 : for(var i=1;i<2;i++){ LABEL2 : do {var x =1;break\u000DFOR2;var y=2;} while(0);} result = i;");
|
||||
if (result!==2) {
|
||||
$ERROR('#2: Since LineTerminator(U-000D) between break and Identifier not allowed break evaluates without label');
|
||||
}
|
||||
} catch(e){
|
||||
|
@ -40,8 +42,8 @@ try{
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#3
|
||||
try{
|
||||
eval("FOR3 : for(var i=1;i<2;i++){ LABEL3 : do {var x =1;break\u2028FOR3;var y=2;} while(0);}");
|
||||
if (i!==2) {
|
||||
eval("FOR3 : for(var i=1;i<2;i++){ LABEL3 : do {var x =1;break\u2028FOR3;var y=2;} while(0);} result = i;");
|
||||
if (result!==2) {
|
||||
$ERROR('#3: Since LineTerminator(U-2028) between break and Identifier not allowed break evaluates without label');
|
||||
}
|
||||
} catch(e){
|
||||
|
@ -53,8 +55,8 @@ try{
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#4
|
||||
try{
|
||||
eval("FOR4 : for(var i=1;i<2;i++){ LABEL4 : do {var x =1;break\u2029FOR4;var y=2;} while(0);}");
|
||||
if (i!==2) {
|
||||
eval("FOR4 : for(var i=1;i<2;i++){ LABEL4 : do {var x =1;break\u2029FOR4;var y=2;} while(0);} result = i;");
|
||||
if (result!==2) {
|
||||
$ERROR('#4: Since LineTerminator(U-2029) between break and Identifier not allowed break evaluates without label');
|
||||
}
|
||||
} catch(e){
|
||||
|
|
|
@ -11,11 +11,13 @@ description: >
|
|||
and Identifier
|
||||
---*/
|
||||
|
||||
var result;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#1
|
||||
try{
|
||||
eval("FOR1 : for(var i=1;i<2;i++){FOR1NESTED : for(var j=1;j<2;j++) { continue\u000AFOR1; } while(0);}");
|
||||
if (j!==2) {
|
||||
eval("FOR1 : for(var i=1;i<2;i++){FOR1NESTED : for(var j=1;j<2;j++) { continue\u000AFOR1; } while(0);} result = j;");
|
||||
if (result!==2) {
|
||||
$ERROR('#1: Since LineTerminator(U-000A) between continue and Identifier not allowed continue evaluates without label');
|
||||
}
|
||||
} catch(e){
|
||||
|
@ -27,8 +29,8 @@ try{
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#2
|
||||
try{
|
||||
eval("FOR2 : for(var i=1;i<2;i++){FOR2NESTED : for(var j=1;j<2;j++) { continue\u000DFOR2; } while(0);}");
|
||||
if (j!==2) {
|
||||
eval("FOR2 : for(var i=1;i<2;i++){FOR2NESTED : for(var j=1;j<2;j++) { continue\u000DFOR2; } while(0);} result = j;");
|
||||
if (result!==2) {
|
||||
$ERROR('#2: Since LineTerminator(U-000D) between continue and Identifier not allowed continue evaluates without label');
|
||||
}
|
||||
} catch(e){
|
||||
|
@ -40,8 +42,8 @@ try{
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#3
|
||||
try{
|
||||
eval("FOR3 : for(var i=1;i<2;i++){FOR3NESTED : for(var j=1;j<2;j++) { continue\u2028FOR3; } while(0);}");
|
||||
if (j!==2) {
|
||||
eval("FOR3 : for(var i=1;i<2;i++){FOR3NESTED : for(var j=1;j<2;j++) { continue\u2028FOR3; } while(0);} result = j;");
|
||||
if (result!==2) {
|
||||
$ERROR('#3: Since LineTerminator(U-2028) between continue and Identifier not allowed continue evaluates without label');
|
||||
}
|
||||
} catch(e){
|
||||
|
@ -53,8 +55,8 @@ try{
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#4
|
||||
try{
|
||||
eval("FOR4 : for(var i=1;i<2;i++){FOR4NESTED : for(var j=1;j<2;j++) { continue\u2029FOR4; } while(0);}");
|
||||
if (j!==2) {
|
||||
eval("FOR4 : for(var i=1;i<2;i++){FOR4NESTED : for(var j=1;j<2;j++) { continue\u2029FOR4; } while(0);} result = j;");
|
||||
if (result!==2) {
|
||||
$ERROR('#4: Since LineTerminator(U-2029) between continue and Identifier not allowed continue evaluates without label');
|
||||
}
|
||||
} catch(e){
|
||||
|
|
|
@ -11,7 +11,7 @@ es5id: 12.4_A2_T1
|
|||
description: Checking by using eval "(eval("x+1+x==1"))"
|
||||
---*/
|
||||
|
||||
var __evaluated;
|
||||
var x, __evaluated;
|
||||
|
||||
x=1;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ es5id: 12.4_A2_T2
|
|||
description: Checking by using eval(eval(x), where x is any string)
|
||||
---*/
|
||||
|
||||
var __evaluated;
|
||||
var x, __evaluated;
|
||||
|
||||
x="5+1|0===0";
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ es5id: 12.6.3_A10.1
|
|||
description: >
|
||||
Checking if executing nested "var-loops" nine blocks depth is
|
||||
evaluated properly
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
|
@ -0,0 +1,113 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Nested "var-loops" nine blocks depth is evaluated properly
|
||||
es5id: 12.6.3_A10.1
|
||||
description: >
|
||||
Checking if executing nested "var-loops" nine blocks depth is
|
||||
evaluated properly
|
||||
---*/
|
||||
|
||||
var __str, index2, index3, index6;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#1
|
||||
try {
|
||||
__in__deepest__loop=__in__deepest__loop;
|
||||
} catch (e) {
|
||||
$ERROR('#1: "__in__deepest__loop=__in__deepest__loop" does not lead to throwing exception');
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#2
|
||||
try {
|
||||
index0=index0;
|
||||
} catch (e) {
|
||||
$ERROR('#2: "index0=index0" does not lead to throwing exception');
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#3
|
||||
try {
|
||||
index1=index1;
|
||||
} catch (e) {
|
||||
$ERROR('#3: "index1=index1" does not lead to throwing exception');
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#4
|
||||
try {
|
||||
index4=index4;
|
||||
} catch (e) {
|
||||
$ERROR('#4: "index4=index4" does not lead to throwing exception');
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#5
|
||||
try {
|
||||
index5=index5;
|
||||
} catch (e) {
|
||||
$ERROR('#4: "index5=index5" does not lead to throwing exception');
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#6
|
||||
try {
|
||||
index7=index7;
|
||||
} catch (e) {
|
||||
$ERROR('#6: "index7=index7" does not lead to throwing exception');
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#7
|
||||
try {
|
||||
index8=index8;
|
||||
} catch (e) {
|
||||
$ERROR('#7: "index8=index8" does not lead to throwing exception');
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__str="";
|
||||
|
||||
for( var index0=0; index0<=1; index0++) {
|
||||
for(var index1=0; index1<=index0; index1++) {
|
||||
for( index2=0; index2<=index1; index2++) {
|
||||
for( index3=0; index3<=index2; index3++) {
|
||||
for(var index4=0; index4<=index3; index4++) {
|
||||
for(var index5=0; index5<=index4; index5++) {
|
||||
for( index6=0; index6<=index5; index6++) {
|
||||
for(var index7=0; index7<=index6; index7++) {
|
||||
for(var index8=0; index8<=index1; index8++) {
|
||||
var __in__deepest__loop;
|
||||
__str+=""+index0+index1+index2+index3+index4+index5+index6+index7+index8+'\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#2
|
||||
if (__str!== "000000000\n100000000\n110000000\n110000001\n111000000\n111000001\n111100000\n111100001\n111110000\n111110001\n111111000\n111111001\n111111100\n111111101\n111111110\n111111111\n") {
|
||||
$ERROR('#2: __str === "000000000\\n100000000\\n110000000\\n110000001\\n111000000\\n111000001\\n111100000\\n111100001\\n111110000\\n111110001\\n111111000\\n111111001\\n111111100\\n111111101\\n111111110\\n111111111\\n". Actual: __str ==='+ __str );
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
|
@ -7,6 +7,7 @@ es5id: 12.6.3_A10
|
|||
description: >
|
||||
Checking if executing nested "var-loops" nine blocks depth is
|
||||
evaluated properly
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
|
@ -0,0 +1,53 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Nested "var-loops" nine blocks depth is evaluated properly
|
||||
es5id: 12.6.3_A10
|
||||
description: >
|
||||
Checking if executing nested "var-loops" nine blocks depth is
|
||||
evaluated properly
|
||||
---*/
|
||||
|
||||
var __str, index0, index1, index2, index3, index4, index5, index6, index7, index8;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#
|
||||
try {
|
||||
__in__deepest__loop=__in__deepest__loop;
|
||||
} catch (e) {
|
||||
$ERROR('#1: "__in__deepest__loop=__in__deepest__loop" does not lead to throwing exception');
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
__str="";
|
||||
|
||||
for( index0=0; index0<=1; index0++) {
|
||||
for( index1=0; index1<=index0; index1++) {
|
||||
for( index2=0; index2<=index1; index2++) {
|
||||
for( index3=0; index3<=index2; index3++) {
|
||||
for( index4=0; index4<=index3; index4++) {
|
||||
for( index5=0; index5<=index4; index5++) {
|
||||
for( index6=0; index6<=index5; index6++) {
|
||||
for( index7=0; index7<=index6; index7++) {
|
||||
for( index8=0; index8<=index1; index8++) {
|
||||
var __in__deepest__loop;
|
||||
__str+=""+index0+index1+index2+index3+index4+index5+index6+index7+index8+'\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#2
|
||||
if (__str!== "000000000\n100000000\n110000000\n110000001\n111000000\n111000001\n111100000\n111100001\n111110000\n111110001\n111111000\n111111001\n111111100\n111111101\n111111110\n111111111\n") {
|
||||
$ERROR('#2: __str === "000000000\\n100000000\\n110000000\\n110000001\\n111000000\\n111000001\\n111100000\\n111100001\\n111110000\\n111110001\\n111111000\\n111111001\\n111111100\\n111111101\\n111111110\\n111111111\\n". Actual: __str ==='+ __str );
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
|
@ -10,6 +10,7 @@ description: >
|
|||
Duplicate identifier allowed in non-strict function declaration
|
||||
parameter list
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase()
|
||||
|
|
|
@ -10,6 +10,7 @@ description: >
|
|||
Duplicate identifier allowed in non-strict function expression
|
||||
parameter list
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase()
|
||||
|
|
|
@ -10,6 +10,7 @@ description: >
|
|||
eval allowed as formal parameter name of a non-strict function
|
||||
declaration
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase()
|
||||
|
|
|
@ -10,6 +10,7 @@ description: >
|
|||
eval allowed as formal parameter name of a non-strict function
|
||||
expression
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase()
|
||||
|
|
|
@ -10,6 +10,7 @@ description: >
|
|||
arguments allowed as formal parameter name of a non-strict
|
||||
function declaration
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase()
|
||||
|
|
|
@ -10,6 +10,7 @@ description: >
|
|||
arguments allowed as formal parameter name of a non-strict
|
||||
function expression
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase()
|
||||
|
|
|
@ -10,6 +10,7 @@ description: >
|
|||
eval allowed as function identifier in non-strict function
|
||||
declaration
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase()
|
||||
|
|
|
@ -10,6 +10,7 @@ description: >
|
|||
eval allowed as function identifier in non-strict function
|
||||
expression
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase()
|
||||
|
|
|
@ -10,6 +10,7 @@ description: >
|
|||
arguments allowed as function identifier in non-strict function
|
||||
declaration
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase()
|
||||
|
|
|
@ -10,6 +10,7 @@ description: >
|
|||
arguments allowed as function identifier in non-strict function
|
||||
expression
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase()
|
||||
|
|
|
@ -9,30 +9,14 @@ es5id: 13.2-15-1
|
|||
description: >
|
||||
Function Object has length as its own property and does not invoke
|
||||
the setter defined on Function.prototype.length (Step 15)
|
||||
includes: [runTestCase.js]
|
||||
includes: [assert.js, propertyHelper.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var fun = function (x, y) { };
|
||||
var fun = function (x, y) { };
|
||||
|
||||
var verifyValue = false;
|
||||
verifyValue = (fun.hasOwnProperty("length") && fun.length === 2);
|
||||
assert(fun.hasOwnProperty("length"));
|
||||
assert.sameValue(fun.length, 2);
|
||||
|
||||
var verifyWritable = false;
|
||||
fun.length = 1001;
|
||||
verifyWritable = (fun.length === 1001);
|
||||
|
||||
var verifyEnumerable = false;
|
||||
for (var p in fun) {
|
||||
if (p === "length") {
|
||||
verifyEnumerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
var verifyConfigurable = false;
|
||||
delete fun.length;
|
||||
verifyConfigurable = fun.hasOwnProperty("length");
|
||||
|
||||
return verifyValue && !verifyWritable && !verifyEnumerable && !verifyConfigurable;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
verifyNotEnumerable(fun, "length");
|
||||
verifyNotWritable(fun, "length");
|
||||
verifyConfigurable(fun, "length");
|
||||
|
|
|
@ -10,48 +10,34 @@ description: >
|
|||
Function Object has 'prototype' as its own property, it is not
|
||||
enumerable and does not invoke the setter defined on
|
||||
Function.prototype (Step 18)
|
||||
includes: [runTestCase.js]
|
||||
includes: [assert.js, propertyHelper.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try {
|
||||
var getFunc = function () {
|
||||
return 100;
|
||||
};
|
||||
try {
|
||||
var getFunc = function () {
|
||||
return 100;
|
||||
};
|
||||
|
||||
var data = "data";
|
||||
var setFunc = function (value) {
|
||||
data = value;
|
||||
};
|
||||
Object.defineProperty(Function.prototype, "prototype", {
|
||||
get: getFunc,
|
||||
set: setFunc,
|
||||
configurable: true
|
||||
});
|
||||
var data = "data";
|
||||
var setFunc = function (value) {
|
||||
data = value;
|
||||
};
|
||||
Object.defineProperty(Function.prototype, "prototype", {
|
||||
get: getFunc,
|
||||
set: setFunc,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
var fun = function () { };
|
||||
var fun = function () { };
|
||||
|
||||
var verifyValue = false;
|
||||
verifyValue = (fun.prototype !== 100 && fun.prototype.toString() === "[object Object]");
|
||||
assert.notSameValue(fun.prototype, 100);
|
||||
assert.sameValue(fun.prototype.toString(), "[object Object]");
|
||||
|
||||
var verifyEnumerable = false;
|
||||
for (var p in fun) {
|
||||
if (p === "prototype" && fun.hasOwnProperty("prototype")) {
|
||||
verifyEnumerable = true;
|
||||
}
|
||||
}
|
||||
verifyNotEnumerable(fun, "prototype");
|
||||
verifyWritable(fun, "prototype");
|
||||
verifyNotConfigurable(fun, "prototype");
|
||||
|
||||
var verifyConfigurable = false;
|
||||
delete fun.prototype;
|
||||
verifyConfigurable = fun.hasOwnProperty("prototype");
|
||||
|
||||
var verifyWritable = false;
|
||||
fun.prototype = 12
|
||||
verifyWritable = (fun.prototype === 12);
|
||||
|
||||
return verifyValue && verifyWritable && !verifyEnumerable && verifyConfigurable && data === "data";
|
||||
} finally {
|
||||
delete Function.prototype.prototype;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(data, "data");
|
||||
} finally {
|
||||
delete Function.prototype.prototype;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: Primitive types are passed by value
|
||||
es5id: 13.2.1_A6_T1
|
||||
description: Declaring a function with "function __func(arg1, arg2)"
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function __func(arg1, arg2){
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: Primitive types are passed by value
|
||||
es5id: 13.2.1_A6_T2
|
||||
description: Declaring a function with "__func = function(arg1, arg2)"
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
__func = function(arg1, arg2){
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Primitive types are passed by value
|
||||
es5id: 13.2.1_A6_T1
|
||||
description: Declaring a function with "function __func(arg1, arg2)"
|
||||
---*/
|
||||
|
||||
var __func, y, b;
|
||||
|
||||
function __func(arg1, arg2){
|
||||
arg1++;
|
||||
arg2+="BA";
|
||||
};
|
||||
|
||||
var x=1;
|
||||
y=2;
|
||||
var a="AB"
|
||||
b="SAM";
|
||||
|
||||
__func(x,a);
|
||||
__func(y,b);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#1
|
||||
if (x!==1 || y!==2 || a!=="AB" || b!=="SAM") {
|
||||
$ERROR('#1: x === 1 and y === 2 and a === "AB" and b === "SAM". Actual: x ==='+x+' and y ==='+y+' and a ==='+a+' and b ==='+b);
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Primitive types are passed by value
|
||||
es5id: 13.2.1_A6_T2
|
||||
description: Declaring a function with "__func = function(arg1, arg2)"
|
||||
---*/
|
||||
|
||||
var __func, y, b;
|
||||
|
||||
__func = function(arg1, arg2){
|
||||
arg1++;
|
||||
arg2+="BA";
|
||||
};
|
||||
|
||||
var x=1;
|
||||
y=2;
|
||||
var a="AB"
|
||||
b="SAM";
|
||||
|
||||
__func(x,a);
|
||||
__func(y,b);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#1
|
||||
if (x!==1 || y!==2 || a!=="AB" || b!=="SAM") {
|
||||
$ERROR('#1: x === 1 and y === 2 and a === "AB" and b === "SAM". Actual: x ==='+x+' and y ==='+y+' and a ==='+a+' and b ==='+b);
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
|
@ -9,6 +9,7 @@ info: >
|
|||
es5id: 13.2.1_A7_T3
|
||||
description: Returning number. Declaring a function with "function __func()"
|
||||
includes: [Test262Error.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function __func(){
|
||||
|
|
|
@ -11,6 +11,8 @@ description: >
|
|||
declared with "obj = {}"
|
||||
---*/
|
||||
|
||||
var obj;
|
||||
|
||||
var __obj = new __FACTORY();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -11,6 +11,8 @@ description: >
|
|||
declared with "var obj = {}"
|
||||
---*/
|
||||
|
||||
var __FACTORY, __obj;
|
||||
|
||||
__FACTORY = function (){
|
||||
this.prop = 1;
|
||||
var obj = {};
|
||||
|
|
|
@ -11,6 +11,8 @@ description: >
|
|||
declared with "obj = {}"
|
||||
---*/
|
||||
|
||||
var __FACTORY, __obj, obj;
|
||||
|
||||
__FACTORY = function(){
|
||||
this.prop = 1;
|
||||
obj = {};
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: FunctionExpression containing "with" statement is admitted
|
||||
es5id: 13.2.2_A17_T2
|
||||
description: Throwing an exception within "with" statement
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
this.p1="alert";
|
||||
|
|
|
@ -9,6 +9,7 @@ description: >
|
|||
var getRight declaration adds variable to function scope but
|
||||
getRight in statement resolves within with(__obj) scope and
|
||||
searchs getRight in __obj first
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
p1="alert";
|
||||
|
|
|
@ -7,6 +7,7 @@ info: >
|
|||
function is admitted
|
||||
es5id: 13.2.2_A18_T1
|
||||
description: "Object is declared with \"var __obj={callee:\"a\"}\""
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var callee=0, b;
|
||||
|
|
|
@ -7,6 +7,7 @@ info: >
|
|||
function is admitted
|
||||
es5id: 13.2.2_A18_T2
|
||||
description: "Object is declared with \"__obj={callee:\"a\"}\""
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
this.callee = 0;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: Function's scope chain is started when it is declared
|
||||
es5id: 13.2.2_A19_T1
|
||||
description: Function is declared in the global scope
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var a = 1;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: Function's scope chain is started when it is declared
|
||||
es5id: 13.2.2_A19_T2
|
||||
description: Function is declared in the object scope. Using "with" statement
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var a = 1;
|
||||
|
|
|
@ -7,6 +7,7 @@ es5id: 13.2.2_A19_T3
|
|||
description: >
|
||||
Function is declared in the object scope and then an exception is
|
||||
thrown
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var a = 1;
|
||||
|
|
|
@ -7,6 +7,7 @@ es5id: 13.2.2_A19_T4
|
|||
description: >
|
||||
Function is declared in the hierarchical object scope and then an
|
||||
exception is thrown
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var a = 1;
|
||||
|
|
|
@ -7,6 +7,7 @@ es5id: 13.2.2_A19_T5
|
|||
description: >
|
||||
Function is declared in the object scope, then an exception is
|
||||
thrown and the object is deleted
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var a = 1;
|
||||
|
|
|
@ -7,6 +7,7 @@ es5id: 13.2.2_A19_T6
|
|||
description: >
|
||||
Function is declared in the "object->do-while" scope, then the
|
||||
object is deleted and another object with the same name is declared
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var a = 1;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: Function's scope chain is started when it is declared
|
||||
es5id: 13.2.2_A19_T7
|
||||
description: Function is declared in the object scope as a variable
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var a = 1;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: Function's scope chain is started when it is declared
|
||||
es5id: 13.2.2_A19_T8
|
||||
description: Function is declared multiply times
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -21,7 +21,7 @@ catch(e){
|
|||
$ERROR('#0: __PROTO.type=__MONSTER does not lead to throwing exception')
|
||||
}
|
||||
|
||||
function __FACTORY(){this.name=__PREDATOR};
|
||||
function __FACTORY(){};
|
||||
|
||||
__FACTORY.prototype=__PROTO;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ catch(e){
|
|||
$FAIL('#0: __PROTO.type=__MONSTER does not lead to throwing exception')
|
||||
}
|
||||
|
||||
var __FACTORY = function(){this.name=__PREDATOR};
|
||||
var __FACTORY = function(){};
|
||||
|
||||
__FACTORY.prototype=__PROTO;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ catch(e){
|
|||
$ERROR('#0: __PROTO.type=__PLANT does not lead to throwing exception')
|
||||
}
|
||||
|
||||
function __FACTORY(){this.name=__ROSE};
|
||||
function __FACTORY(){};
|
||||
|
||||
__FACTORY.prototype=__PROTO;
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ es5id: 13.2.2_A4_T2
|
|||
description: Declaring a function with "__FACTORY = function()"
|
||||
---*/
|
||||
|
||||
var __CUBE, __FACTORY, __device;
|
||||
|
||||
__CUBE="cube";
|
||||
|
||||
__FACTORY = function(){};
|
||||
|
|
|
@ -11,6 +11,8 @@ es5id: 13.2.2_A5_T1
|
|||
description: Declaring a function with "function __FACTORY(arg1, arg2)"
|
||||
---*/
|
||||
|
||||
var __VOLUME, __RED, __ID, __TOP, __BOTTOM, __LEFT, color, top, left, __device;
|
||||
|
||||
__VOLUME=8;
|
||||
__RED="red";
|
||||
__ID=12342;
|
||||
|
|
|
@ -11,6 +11,8 @@ es5id: 13.2.2_A5_T2
|
|||
description: Declaring a function with "__FACTORY = function(arg1, arg2)"
|
||||
---*/
|
||||
|
||||
var __VOLUME, __RED, __ID, __TOP, __BOTTOM, __LEFT, __FACTORY, color, top, left, __device;
|
||||
|
||||
__VOLUME=8;
|
||||
__RED="red";
|
||||
__ID=12342;
|
||||
|
|
|
@ -12,6 +12,8 @@ es5id: 13.2.2_A6_T1
|
|||
description: Declaring a function with "__func = function(arg)"
|
||||
---*/
|
||||
|
||||
var __FOO, __BAR, __func, __obj;
|
||||
|
||||
__FOO="fooValue";
|
||||
__BAR="barValue";
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ es5id: 13.2.2_A7_T2
|
|||
description: Declaring a "function as function __func (arg)"
|
||||
---*/
|
||||
|
||||
var __FRST, __SCND, __func, __obj__;
|
||||
|
||||
__FRST="one";
|
||||
__SCND="two";
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ info: >
|
|||
can be deleted
|
||||
es5id: 13_A11_T1
|
||||
description: Returning result of "delete arguments"
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function __func(){ return delete arguments;}
|
||||
|
|
|
@ -9,6 +9,7 @@ es5id: 13_A11_T2
|
|||
description: >
|
||||
Checking if deleting the arguments property fails and then
|
||||
returning it
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function __func(){
|
||||
|
|
|
@ -7,6 +7,7 @@ es5id: 13_A12_T1
|
|||
description: >
|
||||
Checking if deleting a function that is declared in global scope
|
||||
fails
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
ALIVE="Letov is alive"
|
||||
|
|
|
@ -7,6 +7,7 @@ es5id: 13_A12_T2
|
|||
description: >
|
||||
Checking if deleting a function that is declared in function scope
|
||||
fails
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
ALIVE="Letov is alive"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: Unicode symbols in function name are allowed
|
||||
es5id: 13_A14
|
||||
description: Defining function name with unicode symbols
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
eval("function __func\u0041(__arg){return __arg;};");
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Unicode symbols in function name are allowed
|
||||
es5id: 13_A14
|
||||
description: Defining function name with unicode symbols
|
||||
---*/
|
||||
|
||||
var funcA = eval("function __func\u0041(__arg){return __arg;}; __funcA");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#1
|
||||
if (typeof funcA !== "function") {
|
||||
$ERROR('#1: unicode symbols in function name are allowed');
|
||||
}
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
|
@ -5,6 +5,7 @@
|
|||
info: "''arguments'' variable overrides ActivationObject.arguments"
|
||||
es5id: 13_A15_T1
|
||||
description: Declaring a function with "__func(arguments)"
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function __func(arguments){
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: "''arguments'' variable overrides ActivationObject.arguments"
|
||||
es5id: 13_A15_T2
|
||||
description: Overriding arguments within functions body
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
THE_ANSWER="Answer to Life, the Universe, and Everything";
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: "''arguments'' variable overrides ActivationObject.arguments"
|
||||
es5id: 13_A15_T3
|
||||
description: Declaring a variable named with "arguments" without a function
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
THE_ANSWER="Answer to Life, the Universe, and Everything";
|
||||
|
|
|
@ -7,6 +7,7 @@ es5id: 13_A15_T4
|
|||
description: >
|
||||
Declaring a variable named with "arguments" and following a
|
||||
"return" statement within a function body
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
THE_ANSWER="Answer to Life, the Universe, and Everything";
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: "''arguments'' variable overrides ActivationObject.arguments"
|
||||
es5id: 13_A15_T5
|
||||
description: Creating a variable named with "arguments" without a function
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
THE_ANSWER="Answer to Life, the Universe, and Everything";
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: Any separators are admitted between declaration chunks
|
||||
es5id: 13_A16
|
||||
description: Inserting separators between declaration chunks
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Any separators are admitted between declaration chunks
|
||||
es5id: 13_A16
|
||||
description: Inserting separators between declaration chunks
|
||||
---*/
|
||||
|
||||
function
|
||||
x
|
||||
(
|
||||
)
|
||||
{
|
||||
}
|
||||
;
|
||||
|
||||
x();
|
||||
|
||||
function y ( ) {};
|
||||
|
||||
y();
|
||||
|
||||
function
|
||||
|
||||
z
|
||||
|
||||
(
|
||||
|
||||
)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
z();
|
||||
|
||||
eval("function\u0009\u2029w(\u000C)\u00A0{\u000D}; w()");
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.14-13
|
||||
description: catch introduces scope - updates are based on scope
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -13,6 +13,7 @@ description: >
|
|||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -13,6 +13,7 @@ description: >
|
|||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -13,6 +13,7 @@ description: >
|
|||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.2.1-11
|
||||
description: arguments as var identifier in eval code is allowed
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.2.1-12
|
||||
description: arguments as local var identifier is allowed
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -10,6 +10,7 @@ es5id: 12.2_A2
|
|||
description: >
|
||||
Checking if deleting global variables that have the attributes
|
||||
{DontDelete} fails
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -8,6 +8,7 @@ info: >
|
|||
es5id: 12.2_A5
|
||||
description: Executing eval("var x")
|
||||
includes: [$PRINT.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -9,6 +9,8 @@ description: >
|
|||
the declared variable
|
||||
---*/
|
||||
|
||||
var enumed;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//CHECK#1
|
||||
for (var __prop in this){
|
||||
|
|
|
@ -10,6 +10,7 @@ description: >
|
|||
with does not change declaration scope - vars in with are visible
|
||||
outside
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.10-0-10
|
||||
description: with introduces scope - name lookup finds function parameter
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.10-0-11
|
||||
description: with introduces scope - name lookup finds inner variable
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.10-0-12
|
||||
description: with introduces scope - name lookup finds property
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.10-0-3
|
||||
description: with introduces scope - that is captured by function expression
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.10-0-7
|
||||
description: with introduces scope - scope removed when exiting with statement
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.10-0-8
|
||||
description: with introduces scope - var initializer sets like named property
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.10-0-9
|
||||
description: with introduces scope - name lookup finds outer variable
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.10-2-1
|
||||
description: with - expression being Number
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.10-2-2
|
||||
description: with - expression being Boolean
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.10-2-3
|
||||
description: with - expression being string
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
es5id: 12.10-7-1
|
||||
description: with introduces scope - restores the earlier environment on exit
|
||||
includes: [runTestCase.js]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
|
Loading…
Reference in New Issue