diff options
author | David Fugate <dfugate@microsoft.com> | 2011-10-03 12:20:26 -0700 |
---|---|---|
committer | David Fugate <dfugate@microsoft.com> | 2011-10-03 12:20:26 -0700 |
commit | 69a1080bb68f1b28abd72e33b730f790bbb69aae (patch) | |
tree | 7cceccd22522fa9ceacd8f8b0ab510567f5c7c27 /test/suite/ch10 | |
parent | 6c9436f9775c83ad2ac18dfdab36d2a3aceff24e (diff) |
Renamed Sputnik directories.
Diffstat (limited to 'test/suite/ch10')
90 files changed, 3018 insertions, 0 deletions
diff --git a/test/suite/ch10/10.1/S10.1.1_A1_T1.js b/test/suite/ch10/10.1/S10.1.1_A1_T1.js new file mode 100644 index 000000000..4ca0a1c8b --- /dev/null +++ b/test/suite/ch10/10.1/S10.1.1_A1_T1.js @@ -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. + +/** + * Program functions are defined in source text by a FunctionDeclaration or created dynamically either + * by using a FunctionExpression or by using the built-in Function object as a constructor + * + * @path 10_Execution_Contexts/10.1_Types_of_Executable_Code/S10.1.1_A1_T1.js + * @description Defining function by a FunctionDeclaration + */ + +//CHECK#1 +function f1(){ + return 1; +} +if(typeof(f1)!=="function") + $ERROR('#1: typeof(f1)!=="function"'); + diff --git a/test/suite/ch10/10.1/S10.1.1_A1_T2.js b/test/suite/ch10/10.1/S10.1.1_A1_T2.js new file mode 100644 index 000000000..7d2ac5b69 --- /dev/null +++ b/test/suite/ch10/10.1/S10.1.1_A1_T2.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Program functions are defined in source text by a FunctionDeclaration or created dynamically either + * by using a FunctionExpression or by using the built-in Function object as a constructor + * + * @path 10_Execution_Contexts/10.1_Types_of_Executable_Code/S10.1.1_A1_T2.js + * @description Creating function dynamically by using a FunctionExpression + */ + +//CHECK#1 +var x=function f1(){return 1;}(); +if(x!==1) + $ERROR('#1: Create function dynamically either by using a FunctionExpression'); + +//CHECK#2 +var y=function (){return 2;}(); +if(y!==2){ + $ERROR('#2: Create an anonymous function dynamically either by using a FunctionExpression'); +} + +//CHECK#2 +var z = (function(){return 3;})(); +if(z!==3){ + $ERROR('#3: Create an anonymous function dynamically either by using a FunctionExpression wrapped in a group operator'); +} + diff --git a/test/suite/ch10/10.1/S10.1.1_A1_T3.js b/test/suite/ch10/10.1/S10.1.1_A1_T3.js new file mode 100644 index 000000000..d5b5585cd --- /dev/null +++ b/test/suite/ch10/10.1/S10.1.1_A1_T3.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Program functions are defined in source text by a FunctionDeclaration or created dynamically either + * by using a FunctionExpression or by using the built-in Function object as a constructor + * + * @path 10_Execution_Contexts/10.1_Types_of_Executable_Code/S10.1.1_A1_T3.js + * @description Creating function dynamically by using the built-in Function object as a constructor + */ + +//CHECK#1 +var x=new function f1(){return 1;}; +if(typeof(x.constructor)!=="function") + $ERROR('#1: typeof(x.constructor)!=="function"'); + diff --git a/test/suite/ch10/10.1/S10.1.1_A2_T1.js b/test/suite/ch10/10.1/S10.1.1_A2_T1.js new file mode 100644 index 000000000..1acac2859 --- /dev/null +++ b/test/suite/ch10/10.1/S10.1.1_A2_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * There are two types of Function objects. Internal functions + * are built-in objects of the language, such as parseInt and Math.exp + * + * @path 10_Execution_Contexts/10.1_Types_of_Executable_Code/S10.1.1_A2_T1.js + * @description Checking types of parseInt and Math.exp + */ + +//CHECK#1 +if(typeof(Math.exp)!=="function") + $ERROR('#1: typeof(Math.exp(10))!=="function" '+typeof(Math.exp())); + +//CHECK#2 +if(typeof(parseInt)!=="function") + $ERROR('#2: typeof(parseInt())!=="function" '+typeof(parseInt())); + + diff --git a/test/suite/ch10/10.1/S10.1.6_A1_T1.js b/test/suite/ch10/10.1/S10.1.6_A1_T1.js new file mode 100644 index 000000000..bdd68069c --- /dev/null +++ b/test/suite/ch10/10.1/S10.1.6_A1_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The activation object is initialised with a property with name arguments and attributes {DontDelete} + * + * @path 10_Execution_Contexts/10.1_Types_of_Executable_Code/S10.1.6_A1_T1.js + * @description Checking if deleting function parameter is possible + * @noStrict + */ + +//CHECK#1 +function f1(a){ + delete a; + return a; +} +if (f1(1) !== 1) + $ERROR('#1: Function parameter was deleted'); + + diff --git a/test/suite/ch10/10.1/S10.1.6_A1_T2.js b/test/suite/ch10/10.1/S10.1.6_A1_T2.js new file mode 100644 index 000000000..91092f11d --- /dev/null +++ b/test/suite/ch10/10.1/S10.1.6_A1_T2.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The activation object is initialised with a property with name arguments and attributes {DontDelete} + * + * @path 10_Execution_Contexts/10.1_Types_of_Executable_Code/S10.1.6_A1_T2.js + * @description Checking funtion which returns property "arguments" + */ + +var ARG_STRING = "value of the argument property"; + +function f1() { + this.constructor.prototype.arguments = ARG_STRING; + return arguments; +} + +//CHECK#1 +if ((new f1(1,2,3,4,5)).length !== 5) + $ERROR('#1: (new f1(1,2,3,4,5)).length===5, where f1 returns "arguments" that is set to "'+ ARG_STRING + '"'); + +//CHECK#2 +if ((new f1(1,2,3,4,5))[3] !== 4) + $ERROR('#2: (new f1(1,2,3,4,5))[3]===4, where f1 returns "arguments" that is set to "'+ ARG_STRING + '"'); + +//CHECK#3 +var x = new f1(1,2,3,4,5); +if (delete x[3] !== true) + $ERROR('#3.1: Function parameters have attribute {DontDelete}'); + +if (x[3] === 4) + $ERROR('#3.2: Function parameters have attribute {DontDelete}'); + diff --git a/test/suite/ch10/10.1/S10.1.6_A1_T3.js b/test/suite/ch10/10.1/S10.1.6_A1_T3.js new file mode 100644 index 000000000..7d242ba0a --- /dev/null +++ b/test/suite/ch10/10.1/S10.1.6_A1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The activation object is initialised with a property with name arguments and attributes {DontDelete} + * + * @path 10_Execution_Contexts/10.1_Types_of_Executable_Code/S10.1.6_A1_T3.js + * @description Checking function which returns "this" + * @noStrict + */ + +function f1() { + if (delete arguments) { + $ERROR("#1: Function parameters have attribute {DontDelete}" + arguments); + } + return arguments; +} + +f1(); + diff --git a/test/suite/ch10/10.1/S10.1.7_A1_T1.js b/test/suite/ch10/10.1/S10.1.7_A1_T1.js new file mode 100644 index 000000000..d36d04007 --- /dev/null +++ b/test/suite/ch10/10.1/S10.1.7_A1_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The this value associated with an executioncontext is immutable + * + * @path 10_Execution_Contexts/10.1_Types_of_Executable_Code/S10.1.7_A1_T1.js + * @description Checking if deleting "this" fails + */ + +//CHECK#1 +if (delete this !== true) + $ERROR('#1: The this value associated with an executioncontext is immutable. Actual: this was deleted'); + + diff --git a/test/suite/ch10/10.2/10.2.1/S10.2.1_A1.js b/test/suite/ch10/10.2/10.2.1/S10.2.1_A1.js new file mode 100644 index 000000000..e5bfb3c85 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.1/S10.2.1_A1.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If the caller supplies fewer parameter values than there are + * formal parameters, the extra formal parameters have value undefined + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.1_Environment_Records/S10.1.3_A1.js + * @description Calling function excluding a few parameters + */ + +//CHECK#1 +function f1(a, b){ + return (b === undefined); +} +if(!(f1(1, 2) === false)){ + $ERROR('#1: f1(1, 2) === false'); +} else if(!(f1(1) === true)){ + $ERROR('#1: f1(1) === true'); +} + +//CHECK#2 +function f2(a, b, c){ + return (b === undefined) && (c === undefined); +} +if(!(f2(1) === true)){ + $ERROR('#2: f2(1, 2) === true'); +} + diff --git a/test/suite/ch10/10.2/10.2.1/S10.2.1_A2.js b/test/suite/ch10/10.2/10.2.1/S10.2.1_A2.js new file mode 100644 index 000000000..1490f3af9 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.1/S10.2.1_A2.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If two or more formal parameters share the same name, hence + * the same property, the corresponding property is given the value that was + * supplied for the last parameter with this name + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.1_Environment_Records/S10.1.3_A2.js + * @description Creating functions initialized with two or more formal parameters, which have the same name + * @noStrict + */ + +//CHECK#1 +function f1(x, x) { + return x; +} +if(!(f1(1, 2) === 2)) { + $ERROR("#1: f1(1, 2) === 2"); +} + +//CHECK#2 +function f2(x, x, x){ + return x*x*x; +} +if(!(f2(1, 2, 3) === 27)){ + $ERROR("f2(1, 2, 3) === 27"); +} + +//CHECK#3 +function f3(x, x) { + return 'a' + x; +} +if(!(f3(1, 2) === 'a2')){ + $ERROR("#3: f3(1, 2) === 'a2'"); +} + diff --git a/test/suite/ch10/10.2/10.2.1/S10.2.1_A3.js b/test/suite/ch10/10.2/10.2.1/S10.2.1_A3.js new file mode 100644 index 000000000..bcd5ba628 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.1/S10.2.1_A3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If the value of this last parameter (which has the same + * name as some previous parameters do) was not supplied by the + * caller, the value of the corresponding property is undefined + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.1_Environment_Records/S10.1.3_A3.js + * @description Creating functions with two or more formal parameters, + * that have the same name. Calling this function excluding a few last parameters + */ + +//CHECK#1 +function f1(x, a, b, x){ + return x; +} +if(!(f1(1, 2) === undefined)){ + $ERROR('#1: f1(1, 2) === undefined'); +} + diff --git a/test/suite/ch10/10.2/10.2.1/S10.2.1_A4_T1.js b/test/suite/ch10/10.2/10.2.1/S10.2.1_A4_T1.js new file mode 100644 index 000000000..cb6dfde17 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.1/S10.2.1_A4_T1.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Function declaration in function code - If the variable object + * already has a property with the name of Function Identifier, replace its + * value and attributes. Semantically, this step must follow the creation of + * FormalParameterList properties + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.1_Environment_Records/S10.1.3_A4_T1.js + * @description Checking existence of a function with passed parameter + * @noStrict + */ + +//CHECK#1 +function f1(x){ + return x; + + function x(){ + return 7; + } +} +if(!(f1().constructor.prototype === Function.prototype)){ + $ERROR('#1: f1() returns function'); +} + +//CHECK#2 +function f2(x){ + return typeof x; + + function x(){ + return 7; + } +} +if(!(f2() === "function")){ + $ERROR('#2: f2() === "function"'); +} + +//CHECK#3 +function f3() { + return typeof arguments; + function arguments() { + return 7; + } +} +if (!(f3() === "function")){ + $ERROR('#3: f3() === "function"'); +} + diff --git a/test/suite/ch10/10.2/10.2.1/S10.2.1_A4_T2.js b/test/suite/ch10/10.2/10.2.1/S10.2.1_A4_T2.js new file mode 100644 index 000000000..98459bca6 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.1/S10.2.1_A4_T2.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Function declaration in function code - If the variable object + * already has a property with the name of Function Identifier, replace its + * value and attributes. Semantically, this step must follow the creation of + * FormalParameterList properties + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.1_Environment_Records/S10.1.3_A4_T2.js + * @description Checking existence of a function with declared variable + */ + +//CHECK#1 +function f1(){ + var x; + + return x; + + function x(){ + return 7; + } +} +if(!(f1().constructor.prototype === Function.prototype)){ + $PRINT('#1: f1() returns function'); +} + +//CHECK#2 +function f2(){ + var x; + + return typeof x; + + function x(){ + return 7; + } +} +if(!(f2() === "function")){ + $PRINT('#2: f2() === "function"'); +} + diff --git a/test/suite/ch10/10.2/10.2.1/S10.2.1_A5.1_T1.js b/test/suite/ch10/10.2/10.2.1/S10.2.1_A5.1_T1.js new file mode 100644 index 000000000..6784005ad --- /dev/null +++ b/test/suite/ch10/10.2/10.2.1/S10.2.1_A5.1_T1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * For each VariableDeclaration or VariableDeclarationNoIn in the + * code, create a property of the variable object whose name is the Identifier + * in the VariableDeclaration or VariableDeclarationNoIn, whose value is + * undefined and whose attributes are determined by the type of code + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.1_Environment_Records/S10.1.3_A5.1_T1.js + * @description Checking variable existence only + */ + +//CHECK#1 +function f1(){ + var x; + + return typeof x; +} + +if(!(f1() === "undefined")){ + $PRINT('#1: f1() === "undefined"'); +} + +//CHECK#2 +function f2(){ + var x; + + return x; +} + +if(!(f2() === undefined)){ + $PRINT('#1: f2() === undefined'); +} + diff --git a/test/suite/ch10/10.2/10.2.1/S10.2.1_A5.1_T2.js b/test/suite/ch10/10.2/10.2.1/S10.2.1_A5.1_T2.js new file mode 100644 index 000000000..9ee8fe9ab --- /dev/null +++ b/test/suite/ch10/10.2/10.2.1/S10.2.1_A5.1_T2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * For each VariableDeclaration or VariableDeclarationNoIn in the + * code, create a property of the variable object whose name is the Identifier + * in the VariableDeclaration or VariableDeclarationNoIn, whose value is + * undefined and whose attributes are determined by the type of code + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.1_Environment_Records/S10.1.3_A5.1_T2.js + * @description Checking existence of the variable object property with formal parameter + */ + +//CHECK#1 +function f1(x){ + var x; + + return typeof x; +} + +if(!(f1() === "undefined")){ + $PRINT('#1: f1(1) === "undefined"'); +} + +//CHECK#2 +function f2(x){ + var x; + + return x; +} + +if(!(f2() === undefined)){ + $PRINT('#1: f2(1) === undefined'); +} + diff --git a/test/suite/ch10/10.2/10.2.1/S10.2.1_A5.2_T1.js b/test/suite/ch10/10.2/10.2.1/S10.2.1_A5.2_T1.js new file mode 100644 index 000000000..b06580d44 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.1/S10.2.1_A5.2_T1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If there is already a property of the variable object with the + * name of a declared variable, the value of the property and its attributes + * are not changed + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.1_Environment_Records/S10.1.3_A5.2_T1.js + * @description Checking existence of the variable object property with formal parameter + */ + +//CHECK#1 +function f1(x){ + var x; + + return typeof x; +} + +if(!(f1(1) === "number")){ + $PRINT('#1: f1(1) === "number"'); +} + +//CHECK#2 +function f2(x){ + var x; + + return x; +} + +if(!(f2(1) === 1)){ + $PRINT('#1: f2(1) === 1'); +} + diff --git a/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T1.js b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T1.js new file mode 100644 index 000000000..a4e0323f1 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Every execution context has associated with it a scope chain. + * A scope chain is a list of objects that are searched when evaluating an + * Identifier + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.2__Lexical_Environment_Operations/S10.1.4_A1_T1.js + * @description Checking scope chain containing function declarations + */ + +var x = 0; + +function f1(){ + var x = 1; + function f2(){ + return x; + }; + return f2(); +} + +if(!(f1() === 1)){ + $ERROR("#1: Scope chain disturbed"); +} + diff --git a/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T2.js b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T2.js new file mode 100644 index 000000000..7bd0ab1f5 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Every execution context has associated with it a scope chain. + * A scope chain is a list of objects that are searched when evaluating an + * Identifier + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.2__Lexical_Environment_Operations/S10.1.4_A1_T2.js + * @description Checking scope chain containing function declarations + */ + +var x = 0; + +function f1(){ + function f2(){ + return x; + }; + return f2(); +} + +if(!(f1() === 0)){ + $ERROR("#1: Scope chain disturbed"); +} + diff --git a/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T3.js b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T3.js new file mode 100644 index 000000000..7d3c2e59f --- /dev/null +++ b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Every execution context has associated with it a scope chain. + * A scope chain is a list of objects that are searched when evaluating an + * Identifier + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.2__Lexical_Environment_Operations/S10.1.4_A1_T3.js + * @description Checking scope chain containing function declarations + */ + +var x = 0; + +function f1(){ + function f2(){ + return x; + }; + return f2(); + + var x = 1; +} + +if(!(f1() === undefined)){ + $ERROR("#1: Scope chain disturbed"); +} + + diff --git a/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T4.js b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T4.js new file mode 100644 index 000000000..fba1eda67 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T4.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Every execution context has associated with it a scope chain. + * A scope chain is a list of objects that are searched when evaluating an + * Identifier + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.2__Lexical_Environment_Operations/S10.1.4_A1_T4.js + * @description Checking scope chain containing function declarations + */ + +var x = 0; + +function f1(){ + function f2(){ + return x; + }; + + var x = 1; + return f2(); +} + +if(!(f1() === 1)){ + $ERROR("#1: Scope chain disturbed"); +} + diff --git a/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T5.js b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T5.js new file mode 100644 index 000000000..156bab36c --- /dev/null +++ b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T5.js @@ -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. + +/** + * Every execution context has associated with it a scope chain. + * A scope chain is a list of objects that are searched when evaluating an + * Identifier + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.2__Lexical_Environment_Operations/S10.1.4_A1_T5.js + * @description Checking scope chain containing function declarations and "with" + * @noStrict + */ + +var x = 0; + +var myObj = {x : "obj"}; + +function f1(){ + var x = 1; + function f2(){ + with(myObj){ + return x; + } + }; + return f2(); +} + +if(!(f1() === "obj")){ + $ERROR("#1: Scope chain disturbed"); +} + diff --git a/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T6.js b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T6.js new file mode 100644 index 000000000..d4247f85a --- /dev/null +++ b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T6.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Every execution context has associated with it a scope chain. + * A scope chain is a list of objects that are searched when evaluating an + * Identifier + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.2__Lexical_Environment_Operations/S10.1.4_A1_T6.js + * @description Checking scope chain containing function declarations and "with" + * @noStrict + */ + +var x = 0; + +var myObj = {x : "obj"}; + +function f1(){ + function f2(){ + with(myObj){ + return x; + } + }; + return f2(); +} + +if(!(f1() === "obj")){ + $ERROR("#1: Scope chain disturbed"); +} + diff --git a/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T7.js b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T7.js new file mode 100644 index 000000000..d8b2fbdc1 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T7.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Every execution context has associated with it a scope chain. + * A scope chain is a list of objects that are searched when evaluating an + * Identifier + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.2__Lexical_Environment_Operations/S10.1.4_A1_T7.js + * @description Checking scope chain containing function declarations and "with" + * @noStrict + */ + +var x = 0; + +var myObj = {x : "obj"}; + +function f1(){ + function f2(){ + with(myObj){ + return x; + } + }; + return f2(); + + var x = 1; +} + +if(!(f1() === "obj")){ + $ERROR("#1: Scope chain disturbed"); +} + diff --git a/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T8.js b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T8.js new file mode 100644 index 000000000..429741cec --- /dev/null +++ b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T8.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Every execution context has associated with it a scope chain. + * A scope chain is a list of objects that are searched when evaluating an + * Identifier + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.2__Lexical_Environment_Operations/S10.1.4_A1_T8.js + * @description Checking scope chain containing function declarations and "with" + * @noStrict + */ + +var x = 0; + +var myObj = {x : "obj"}; + +function f1(){ + function f2(){ + with(myObj){ + return x; + } + }; + + var x = 1; + return f2(); +} + +if(!(f1() === "obj")){ + $ERROR("#1: Scope chain disturbed"); +} + diff --git a/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T9.js b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T9.js new file mode 100644 index 000000000..7ad5aa6d4 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.2/S10.2.2_A1_T9.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Every execution context has associated with it a scope chain. + * A scope chain is a list of objects that are searched when evaluating an + * Identifier + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.2__Lexical_Environment_Operations/S10.1.4_A1_T9.js + * @description Checking scope chain containing function declarations and "with" + * @noStrict + */ + +var x = 0; + +var myObj = {x : "obj"}; + +function f1(){ + with(myObj){ + return x; + } +} + +if(!(f1() === "obj")){ + $ERROR("#1: Scope chain disturbed"); +} + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.1_T1.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.1_T1.js new file mode 100644 index 000000000..553b99a9b --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.1_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object has properties such as built-in objects such as + * Math, String, Date, parseInt, etc + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A1.1_T1.js + * @description Global execution context - Value Properties + */ + +//CHECK#1 +if ( NaN === null ) { + $ERROR("#1: NaN === null"); +} + +//CHECK#2 +if ( Infinity === null ) { + $ERROR("#2: Infinity === null"); +} + +//CHECK#3 +if ( undefined === null ) { + $ERROR("#3: undefined === null"); +} + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.1_T2.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.1_T2.js new file mode 100644 index 000000000..6d067d9d9 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.1_T2.js @@ -0,0 +1,56 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object has properties such as built-in objects such as + * Math, String, Date, parseInt, etc + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A1.1_T2.js + * @description Global execution context - Function Properties + */ + +//CHECK#4 +if ( eval === null ) { + $ERROR("#4: eval === null"); +} + +//CHECK#5 +if ( parseInt === null ) { + $ERROR("#5: parseInt === null"); +} + +//CHECK#6 +if ( parseFloat === null ) { + $ERROR("#6: parseFloat === null"); +} + +//CHECK#7 +if ( isNaN === null ) { + $ERROR("#7: isNaN === null"); +} + +//CHECK#8 +if ( isFinite === null ) { + $ERROR("#8: isFinite === null"); +} + +//CHECK#9 +if ( decodeURI === null ) { + $ERROR("#9: decodeURI === null"); +} + +//CHECK#10 +if ( decodeURIComponent === null ) { + $ERROR("#10: decodeURIComponent === null"); +} + +//CHECK#11 +if ( encodeURI === null ) { + $ERROR("#11: encodeURI === null"); +} + +//CHECK#12 +if ( encodeURIComponent === null ) { + $ERROR("#12: encodeURIComponent === null"); +} + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.1_T3.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.1_T3.js new file mode 100644 index 000000000..e76916d03 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.1_T3.js @@ -0,0 +1,87 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object has properties such as built-in objects such as + * Math, String, Date, parseInt, etc + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A1.1_T3.js + * @description Global execution context - Constructor Properties + */ + +//CHECK#13 +if ( Object === null ) { + $ERROR("#13: Object === null"); +} + +//CHECK#14 +if ( Function === null ) { + $ERROR("#14: Function === null"); +} + +//CHECK#15 +if ( String === null ) { + $ERROR("#15: String === null"); +} + +//CHECK#16 +if ( Number === null ) { + $ERROR("#16: Number === null"); +} + +//CHECK#17 +if ( Array === null ) { + $ERROR("#17: Array === null"); +} + +//CHECK#18 +if ( Boolean === null ) { + $ERROR("#20: Boolean === null"); +} + +//CHECK#18 +if ( Date === null ) { + $ERROR("#18: Date === null"); +} + +//CHECK#19 +if ( RegExp === null ) { + $ERROR("#19: RegExp === null"); +} + +//CHECK#20 +if ( Error === null ) { + $ERROR("#20: Error === null"); +} + +//CHECK#21 +if ( EvalError === null ) { + $ERROR("#21: EvalError === null"); +} + +//CHECK#22 +if ( RangeError === null ) { + $ERROR("#22: RangeError === null"); +} + +//CHECK#23 +if ( ReferenceError === null ) { + $ERROR("#23: ReferenceError === null"); +} + +//CHECK#24 +if ( SyntaxError === null ) { + $ERROR("#24: SyntaxError === null"); +} + +//CHECK#25 +if ( TypeError === null ) { + $ERROR("#25: TypeError === null"); +} + +//CHECK#26 +if ( URIError === null ) { + $ERROR("#26: URIError === null"); +} + + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.1_T4.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.1_T4.js new file mode 100644 index 000000000..b752f6fb1 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.1_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object has properties such as built-in objects such as + * Math, String, Date, parseInt, etc + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A1.1_T4.js + * @description Global execution context - Other Properties + */ + +//CHECK#27 +if ( Math === null ) { + $ERROR("#27: Math === null"); +} + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.2_T1.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.2_T1.js new file mode 100644 index 000000000..59ab50c50 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.2_T1.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object has properties such as built-in objects such as + * Math, String, Date, parseInt, etc + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A1.2_T1.js + * @description Function execution context - Value Properties + */ + +function test() { + //CHECK#1 + if ( NaN === null ) { + $ERROR("#1: NaN === null"); + } + + //CHECK#2 + if ( Infinity === null ) { + $ERROR("#2: Infinity === null"); + } + + //CHECK#3 + if ( undefined === null ) { + $ERROR("#3: undefined === null"); + } +} + +test(); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.2_T2.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.2_T2.js new file mode 100644 index 000000000..48e4a7b07 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.2_T2.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object has properties such as built-in objects such as + * Math, String, Date, parseInt, etc + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A1.2_T2.js + * @description Function execution context - Function Properties + */ + +function test() { + //CHECK#4 + if ( eval === null ) { + $ERROR("#4: eval === null"); + } + + //CHECK#5 + if ( parseInt === null ) { + $ERROR("#5: parseInt === null"); + } + + //CHECK#6 + if ( parseFloat === null ) { + $ERROR("#6: parseFloat === null"); + } + + //CHECK#7 + if ( isNaN === null ) { + $ERROR("#7: isNaN === null"); + } + + //CHECK#8 + if ( isFinite === null ) { + $ERROR("#8: isFinite === null"); + } + + //CHECK#9 + if ( decodeURI === null ) { + $ERROR("#9: decodeURI === null"); + } + + //CHECK#10 + if ( decodeURIComponent === null ) { + $ERROR("#10: decodeURIComponent === null"); + } + + //CHECK#11 + if ( encodeURI === null ) { + $ERROR("#11: encodeURI === null"); + } + + //CHECK#12 + if ( encodeURIComponent === null ) { + $ERROR("#12: encodeURIComponent === null"); + } +} + +test(); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.2_T3.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.2_T3.js new file mode 100644 index 000000000..4402003bf --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.2_T3.js @@ -0,0 +1,90 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object has properties such as built-in objects such as + * Math, String, Date, parseInt, etc + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A1.2_T3.js + * @description Function execution context - Constructor Properties + */ + +function test() { + //CHECK#13 + if ( Object === null ) { + $ERROR("#13: Object === null"); + } + + //CHECK#14 + if ( Function === null ) { + $ERROR("#14: Function === null"); + } + + //CHECK#15 + if ( String === null ) { + $ERROR("#15: String === null"); + } + + //CHECK#16 + if ( Number === null ) { + $ERROR("#16: Function === null"); + } + + //CHECK#17 + if ( Array === null ) { + $ERROR("#17: Array === null"); + } + + //CHECK#18 + if ( Boolean === null ) { + $ERROR("#20: Boolean === null"); + } + + //CHECK#18 + if ( Date === null ) { + $ERROR("#18: Date === null"); + } + + //CHECK#19 + if ( RegExp === null ) { + $ERROR("#19: RegExp === null"); + } + + //CHECK#20 + if ( Error === null ) { + $ERROR("#20: Error === null"); + } + + //CHECK#21 + if ( EvalError === null ) { + $ERROR("#21: EvalError === null"); + } + + //CHECK#22 + if ( RangeError === null ) { + $ERROR("#22: RangeError === null"); + } + + //CHECK#23 + if ( ReferenceError === null ) { + $ERROR("#23: ReferenceError === null"); + } + + //CHECK#24 + if ( SyntaxError === null ) { + $ERROR("#24: SyntaxError === null"); + } + + //CHECK#25 + if ( TypeError === null ) { + $ERROR("#25: TypeError === null"); + } + + //CHECK#26 + if ( URIError === null ) { + $ERROR("#26: URIError === null"); + } +} + +test(); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.2_T4.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.2_T4.js new file mode 100644 index 000000000..381b8c9de --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.2_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object has properties such as built-in objects such as + * Math, String, Date, parseInt, etc + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A1.2_T4.js + * @description Function execution context - Other Properties + */ + +function test() { + //CHECK#27 + if ( Math === null ) { + $ERROR("#27: Math === null"); + } +} + +test(); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.3_T1.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.3_T1.js new file mode 100644 index 000000000..85834d393 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.3_T1.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object has properties such as built-in objects such as + * Math, String, Date, parseInt, etc + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A1.3_T1.js + * @description Eval execution context - Value Properties + */ + +var evalStr = +'//CHECK#1\n'+ +'if ( NaN === null ) {\n'+ +' $ERROR("#1: NaN === null");\n'+ +'}\n'+ + +'//CHECK#2\n'+ +'if ( Infinity === null ) {\n'+ +' $ERROR("#2: Infinity === null");\n'+ +'}\n'+ + +'//CHECK#3\n'+ +'if ( undefined === null ) {\n'+ +' $ERROR("#3: undefined === null");\n'+ +'}\n'+ +';\n'; + +eval(evalStr); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.3_T2.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.3_T2.js new file mode 100644 index 000000000..49ed920fb --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.3_T2.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object has properties such as built-in objects such as + * Math, String, Date, parseInt, etc + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A1.3_T2.js + * @description Eval execution context - Function Properties + */ + +var evalStr = +'//CHECK#4\n'+ +'if ( eval === null ) {\n'+ +' $ERROR("#4: eval === null");\n'+ +'}\n'+ + +'//CHECK#5\n'+ +'if ( parseInt === null ) {\n'+ +' $ERROR("#5: parseInt === null");\n'+ +'}\n'+ + +'//CHECK#6\n'+ +'if ( parseFloat === null ) {\n'+ +' $ERROR("#6: parseFloat === null");\n'+ +'}\n'+ + +'//CHECK#7\n'+ +'if ( isNaN === null ) {\n'+ +' $ERROR("#7: isNaN === null");\n'+ +'}\n'+ + +'//CHECK#8\n'+ +'if ( isFinite === null ) {\n'+ +' $ERROR("#8: isFinite === null");\n'+ +'}\n'+ + +'//CHECK#9\n'+ +'if ( decodeURI === null ) {\n'+ +' $ERROR("#9: decodeURI === null");\n'+ +'}\n'+ + +'//CHECK#10\n'+ +'if ( decodeURIComponent === null ) {\n'+ +' $ERROR("#10: decodeURIComponent === null");\n'+ +'}\n'+ + +'//CHECK#11\n'+ +'if ( encodeURI === null ) {\n'+ +' $ERROR("#11: encodeURI === null");\n'+ +'}\n'+ + +'//CHECK#12\n'+ +'if ( encodeURIComponent === null ) {\n'+ +' $ERROR("#12: encodeURIComponent === null");\n'+ +'}\n'+ +';\n'; + +eval(evalStr); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.3_T3.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.3_T3.js new file mode 100644 index 000000000..22f98d3df --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.3_T3.js @@ -0,0 +1,90 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object has properties such as built-in objects such as + * Math, String, Date, parseInt, etc + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A1.3_T3.js + * @description Eval execution context - Constructor Properties + */ + +var evalStr = +'//CHECK#13\n'+ +'if ( Object === null ) {\n'+ +' $ERROR("#13: Object === null");\n'+ +'}\n'+ + +'//CHECK#14\n'+ +'if ( Function === null ) {\n'+ +' $ERROR("#14: Function === null");\n'+ +'}\n'+ + +'//CHECK#15\n'+ +'if ( String === null ) {\n'+ +' $ERROR("#15: String === null");\n'+ +'}\n'+ + +'//CHECK#16\n'+ +'if ( Number === null ) {\n'+ +' $ERROR("#16: Function === null");\n'+ +'}\n'+ + +'//CHECK#17\n'+ +'if ( Array === null ) {\n'+ +' $ERROR("#17: Array === null");\n'+ +'}\n'+ + +'//CHECK#18\n'+ +'if ( Boolean === null ) {\n'+ +' $ERROR("#20: Boolean === null");\n'+ +'}\n'+ + +'//CHECK#18\n'+ +'if ( Date === null ) {\n'+ +' $ERROR("#18: Date === null");\n'+ +'}\n'+ + +'//CHECK#19\n'+ +'if ( RegExp === null ) {\n'+ +' $ERROR("#19: RegExp === null");\n'+ +'}\n'+ + +'//CHECK#20\n'+ +'if ( Error === null ) {\n'+ +' $ERROR("#20: Error === null");\n'+ +'}\n'+ + +'//CHECK#21\n'+ +'if ( EvalError === null ) {\n'+ +' $ERROR("#21: EvalError === null");\n'+ +'}\n'+ + +'//CHECK#22\n'+ +'if ( RangeError === null ) {\n'+ +' $ERROR("#22: RangeError === null");\n'+ +'}\n'+ + +'//CHECK#23\n'+ +'if ( ReferenceError === null ) {\n'+ +' $ERROR("#23: ReferenceError === null");\n'+ +'}\n'+ + +'//CHECK#24\n'+ +'if ( SyntaxError === null ) {\n'+ +' $ERROR("#24: SyntaxError === null");\n'+ +'}\n'+ + +'//CHECK#25\n'+ +'if ( TypeError === null ) {\n'+ +' $ERROR("#25: TypeError === null");\n'+ +'}\n'+ + +'//CHECK#26\n'+ +'if ( URIError === null ) {\n'+ +' $ERROR("#26: URIError === null");\n'+ +'}\n'+ +';\n'; + +eval(evalStr); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.3_T4.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.3_T4.js new file mode 100644 index 000000000..d6d6f7683 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A1.3_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object has properties such as built-in objects such as + * Math, String, Date, parseInt, etc + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A1.3_T4.js + * @description Eval execution context - Other Properties + */ + +var evalStr = +'//CHECK#27\n'+ +'if ( Math === null ) {\n'+ +' $ERROR("#27: Math === null");\n'+ +'}\n'+ +';\n'; + +eval(evalStr); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.1_T1.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.1_T1.js new file mode 100644 index 000000000..d41bb0d50 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.1_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object properties have attributes { DontEnum } + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A2.1_T1.js + * @description Global execution context - Value Properties + */ + +//CHECK#1 +for (var x in this) { + if ( x === 'NaN' ) { + $ERROR("#1: 'NaN' have attribute DontEnum"); + } else if ( x === 'Infinity' ) { + $ERROR("#1: 'Infinity' have attribute DontEnum"); + } else if ( x === 'undefined' ) { + $ERROR("#1: 'undefined' have attribute DontEnum"); + } +} + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.1_T2.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.1_T2.js new file mode 100644 index 000000000..c2129f86a --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.1_T2.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object properties have attributes { DontEnum } + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A2.1_T2.js + * @description Global execution context - Function Properties + */ + +//CHECK#1 +for (var x in this) { + if ( x === 'eval' ) { + $ERROR("#1: 'eval' have attribute DontEnum"); + } else if ( x === 'parseInt' ) { + $ERROR("#1: 'parseInt' have attribute DontEnum"); + } else if ( x === 'parseFloat' ) { + $ERROR("#1: 'parseFloat' have attribute DontEnum"); + } else if ( x === 'isNaN' ) { + $ERROR("#1: 'isNaN' have attribute DontEnum"); + } else if ( x === 'isFinite' ) { + $ERROR("#1: 'isFinite' have attribute DontEnum"); + } else if ( x === 'decodeURI' ) { + $ERROR("#1: 'decodeURI' have attribute DontEnum"); + } else if ( x === 'decodeURIComponent' ) { + $ERROR("#1: 'decodeURIComponent' have attribute DontEnum"); + } else if ( x === 'encodeURI' ) { + $ERROR("#1: 'encodeURI' have attribute DontEnum"); + } else if ( x === 'encodeURIComponent' ) { + $ERROR("#1: 'encodeURIComponent' have attribute DontEnum"); + } +} + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.1_T3.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.1_T3.js new file mode 100644 index 000000000..d44354558 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.1_T3.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object properties have attributes { DontEnum } + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A2.1_T3.js + * @description Global execution context - Constructor Properties + */ + +//CHECK#1 +for (var x in this) { + if ( x === 'Object' ) { + $ERROR("#1: 'property 'Object' have attribute DontEnum"); + } else if ( x === 'Function') { + $ERROR("#1: 'Function' have attribute DontEnum"); + } else if ( x === 'String' ) { + $ERROR("#1: 'String' have attribute DontEnum"); + } else if ( x === 'Number' ) { + $ERROR("#1: 'Number' have attribute DontEnum"); + } else if ( x === 'Array' ) { + $ERROR("#1: 'Array' have attribute DontEnum"); + } else if ( x === 'Boolean' ) { + $ERROR("#1: 'Boolean' have attribute DontEnum"); + } else if ( x === 'Date' ) { + $ERROR("#1: 'Date' have attribute DontEnum"); + } else if ( x === 'RegExp' ) { + $ERROR("#1: 'RegExp' have attribute DontEnum"); + } else if ( x === 'Error' ) { + $ERROR("#1: 'Error' have attribute DontEnum"); + } else if ( x === 'EvalError' ) { + $ERROR("#1: 'EvalError' have attribute DontEnum"); + } else if ( x === 'RangeError' ) { + $ERROR("#1: 'RangeError' have attribute DontEnum"); + } else if ( x === 'ReferenceError' ) { + $ERROR("#1: 'ReferenceError' have attribute DontEnum"); + } else if ( x === 'SyntaxError' ) { + $ERROR("#1: 'SyntaxError' have attribute DontEnum"); + } else if ( x === 'TypeError' ) { + $ERROR("#1: 'TypeError' have attribute DontEnum"); + } else if ( x === 'URIError' ) { + $ERROR("#1: 'URIError' have attribute DontEnum"); + } +} + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.1_T4.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.1_T4.js new file mode 100644 index 000000000..d64804542 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.1_T4.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object properties have attributes { DontEnum } + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A2.1_T4.js + * @description Global execution context - Other Properties + */ + +//CHECK#1 +for (var x in this) { + if ( x === 'Math' ) { + $ERROR("#1: 'Math' have attribute DontEnum"); + } +} + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.2_T1.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.2_T1.js new file mode 100644 index 000000000..4385c0eba --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.2_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object properties have attributes { DontEnum } + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A2.2_T1.js + * @description Function execution context - Value Properties + */ + +function test() { + //CHECK#1 + for (var x in this) { + if ( x === 'NaN' ) { + $ERROR("#1: 'NaN' have attribute DontEnum"); + } else if ( x === 'Infinity' ) { + $ERROR("#1: 'Infinity' have attribute DontEnum"); + } else if ( x === 'undefined' ) { + $ERROR("#1: 'undefined' have attribute DontEnum"); + } + } +} + +test(); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.2_T2.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.2_T2.js new file mode 100644 index 000000000..6f4a5ddca --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.2_T2.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object properties have attributes { DontEnum } + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A2.2_T2.js + * @description Function execution context - Function Properties + */ + +function test() { + //CHECK#1 + for (var x in this) { + if ( x === 'eval' ) { + $ERROR("#1: 'eval' have attribute DontEnum"); + } else if ( x === 'parseInt' ) { + $ERROR("#1: 'parseInt' have attribute DontEnum"); + } else if ( x === 'parseFloat' ) { + $ERROR("#1: 'parseFloat' have attribute DontEnum"); + } else if ( x === 'isNaN' ) { + $ERROR("#1: 'isNaN' have attribute DontEnum"); + } else if ( x === 'isFinite' ) { + $ERROR("#1: 'isFinite' have attribute DontEnum"); + } else if ( x === 'decodeURI' ) { + $ERROR("#1: 'decodeURI' have attribute DontEnum"); + } else if ( x === 'decodeURIComponent' ) { + $ERROR("#1: 'decodeURIComponent' have attribute DontEnum"); + } else if ( x === 'encodeURI' ) { + $ERROR("#1: 'encodeURI' have attribute DontEnum"); + } else if ( x === 'encodeURIComponent' ) { + $ERROR("#1: 'encodeURIComponent' have attribute DontEnum"); + } + } +} + +test(); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.2_T3.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.2_T3.js new file mode 100644 index 000000000..9ad7a969b --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.2_T3.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object properties have attributes { DontEnum } + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A2.2_T3.js + * @description Function execution context - Constructor Properties + */ + +function test() { + //CHECK#1 + for (var x in this) { + if ( x === 'Object' ) { + $ERROR("#1: 'property 'Object' have attribute DontEnum"); + } else if ( x === 'Function') { + $ERROR("#1: 'Function' have attribute DontEnum"); + } else if ( x === 'String' ) { + $ERROR("#1: 'String' have attribute DontEnum"); + } else if ( x === 'Number' ) { + $ERROR("#1: 'Number' have attribute DontEnum"); + } else if ( x === 'Array' ) { + $ERROR("#1: 'Array' have attribute DontEnum"); + } else if ( x === 'Boolean' ) { + $ERROR("#1: 'Boolean' have attribute DontEnum"); + } else if ( x === 'Date' ) { + $ERROR("#1: 'Date' have attribute DontEnum"); + } else if ( x === 'RegExp' ) { + $ERROR("#1: 'RegExp' have attribute DontEnum"); + } else if ( x === 'Error' ) { + $ERROR("#1: 'Error' have attribute DontEnum"); + } else if ( x === 'EvalError' ) { + $ERROR("#1: 'EvalError' have attribute DontEnum"); + } else if ( x === 'RangeError' ) { + $ERROR("#1: 'RangeError' have attribute DontEnum"); + } else if ( x === 'ReferenceError' ) { + $ERROR("#1: 'ReferenceError' have attribute DontEnum"); + } else if ( x === 'SyntaxError' ) { + $ERROR("#1: 'SyntaxError' have attribute DontEnum"); + } else if ( x === 'TypeError' ) { + $ERROR("#1: 'TypeError' have attribute DontEnum"); + } else if ( x === 'URIError' ) { + $ERROR("#1: 'URIError' have attribute DontEnum"); + } + } +} + +test(); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.2_T4.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.2_T4.js new file mode 100644 index 000000000..ec20ca1f9 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.2_T4.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object properties have attributes { DontEnum } + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A2.2_T4.js + * @description Function execution context - Other Properties + */ + +function test() { + //CHECK#1 + for (var x in this) { + if ( x === 'Math' ) { + $ERROR("#1: 'Math' have attribute DontEnum"); + } + } +} + +test(); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.3_T1.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.3_T1.js new file mode 100644 index 000000000..1a5d4f676 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object properties have attributes { DontEnum } + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A2.3_T1.js + * @description Global execution context - Value Properties + */ + +var evalStr = +'//CHECK#1\n'+ +'for (var x in this) {\n'+ +' if ( x === \'NaN\' ) {\n'+ +' $ERROR("#1: \'NaN\' have attribute DontEnum");\n'+ +' } else if ( x === \'Infinity\' ) {\n'+ +' $ERROR("#1: \'Infinity\' have attribute DontEnum");\n'+ +' } else if ( x === \'undefined\' ) {\n'+ +' $ERROR("#1: \'undefined\' have attribute DontEnum");\n'+ +' }\n'+ +'}\n'; + +eval(evalStr); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.3_T2.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.3_T2.js new file mode 100644 index 000000000..eca5d6ddb --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.3_T2.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object properties have attributes { DontEnum } + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A2.3_T2.js + * @description Global execution context - Function Properties + */ + +var evalStr = +'//CHECK#1\n'+ +'for (var x in this) {\n'+ +' if ( x === \'eval\' ) {\n'+ +' $ERROR("#1: \'eval\' have attribute DontEnum");\n'+ +' } else if ( x === \'parseInt\' ) {\n'+ +' $ERROR("#1: \'parseInt\' have attribute DontEnum");\n'+ +' } else if ( x === \'parseFloat\' ) {\n'+ +' $ERROR("#1: \'parseFloat\' have attribute DontEnum");\n'+ +' } else if ( x === \'isNaN\' ) {\n'+ +' $ERROR("#1: \'isNaN\' have attribute DontEnum");\n'+ +' } else if ( x === \'isFinite\' ) {\n'+ +' $ERROR("#1: \'isFinite\' have attribute DontEnum");\n'+ +' } else if ( x === \'decodeURI\' ) {\n'+ +' $ERROR("#1: \'decodeURI\' have attribute DontEnum");\n'+ +' } else if ( x === \'decodeURIComponent\' ) {\n'+ +' $ERROR("#1: \'decodeURIComponent\' have attribute DontEnum");\n'+ +' } else if ( x === \'encodeURI\' ) {\n'+ +' $ERROR("#1: \'encodeURI\' have attribute DontEnum");\n'+ +' } else if ( x === \'encodeURIComponent\' ) {\n'+ +' $ERROR("#1: \'encodeURIComponent\' have attribute DontEnum");\n'+ +' }\n'+ +'}\n'; + +eval(evalStr); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.3_T3.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.3_T3.js new file mode 100644 index 000000000..b77796f0e --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.3_T3.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object properties have attributes { DontEnum } + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A2.3_T3.js + * @description Global execution context - Constructor Properties + */ + +var evalStr = +'//CHECK#1\n'+ +'for (var x in this) {\n'+ +' if ( x === \'Object\' ) {\n'+ +' $ERROR("#1: \'Object\' have attribute DontEnum");\n'+ +' } else if ( x === \'Function\') {\n'+ +' $ERROR("#1: \'Function\' have attribute DontEnum");\n'+ +' } else if ( x === \'String\' ) {\n'+ +' $ERROR("#1: \'String\' have attribute DontEnum");\n'+ +' } else if ( x === \'Number\' ) {\n'+ +' $ERROR("#1: \'Number\' have attribute DontEnum");\n'+ +' } else if ( x === \'Array\' ) {\n'+ +' $ERROR("#1: \'Array\' have attribute DontEnum");\n'+ +' } else if ( x === \'Boolean\' ) {\n'+ +' $ERROR("#1: \'Boolean\' have attribute DontEnum");\n'+ +' } else if ( x === \'Date\' ) {\n'+ +' $ERROR("#1: \'Date\' have attribute DontEnum");\n'+ +' } else if ( x === \'RegExp\' ) {\n'+ +' $ERROR("#1: \'RegExp\' have attribute DontEnum");\n'+ +' } else if ( x === \'Error\' ) {\n'+ +' $ERROR("#1: \'Error\' have attribute DontEnum");\n'+ +' } else if ( x === \'EvalError\' ) {\n'+ +' $ERROR("#1: \'EvalError\' have attribute DontEnum");\n'+ +' } else if ( x === \'RangeError\' ) {\n'+ +' $ERROR("#1: \'RangeError\' have attribute DontEnum");\n'+ +' } else if ( x === \'ReferenceError\' ) {\n'+ +' $ERROR("#1: \'ReferenceError\' have attribute DontEnum");\n'+ +' } else if ( x === \'SyntaxError\' ) {\n'+ +' $ERROR("#1: \'SyntaxError\' have attribute DontEnum");\n'+ +' } else if ( x === \'TypeError\' ) {\n'+ +' $ERROR("#1: \'TypeError\' have attribute DontEnum");\n'+ +' } else if ( x === \'URIError\' ) {\n'+ +' $ERROR("#1: \'URIError\' have attribute DontEnum");\n'+ +' }\n'+ +'}\n'; + +eval(evalStr); + diff --git a/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.3_T4.js b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.3_T4.js new file mode 100644 index 000000000..cc1864183 --- /dev/null +++ b/test/suite/ch10/10.2/10.2.3/S10.2.3_A2.3_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global object properties have attributes { DontEnum } + * + * @path 10_Execution_Contexts/10.2_Lexical_Environments/10.2.3_The_Global_Environment/S10.1.5_A2.3_T4.js + * @description Global execution context - Other Properties + */ + +var evalStr = +'//CHECK#1\n'+ +'for (var x in this) {\n'+ +' if ( x === \'Math\' ) {\n'+ +' $ERROR("#1: \'Math\' have attribute DontEnum");\n'+ +' }\n'+ +'}\n'; + +eval(evalStr); + diff --git a/test/suite/ch10/10.4/10.4.1/S10.4.1_A1_T1.js b/test/suite/ch10/10.4/10.4.1/S10.4.1_A1_T1.js new file mode 100644 index 000000000..0c45db329 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.1/S10.4.1_A1_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Variable instantiation is performed using the global object as + * the variable object and using property attributes { DontDelete } + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.1_Global_Code/S10.2.1_A1_T1.js + * @description Checking if deleting variable x, that is defined as var x = 1, fails + * @noStrict + */ + +var x = 1; + +if (this.x !== 1) { + $ERROR("#1: variable x is a property of global object"); +} + +if(delete this.x !== false){ + $ERROR("#2: variable x has property attribute DontDelete"); +} + diff --git a/test/suite/ch10/10.4/10.4.1/S10.4.1_A1_T2.js b/test/suite/ch10/10.4/10.4.1/S10.4.1_A1_T2.js new file mode 100644 index 000000000..62649b112 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.1/S10.4.1_A1_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Variable instantiation is performed using the global object as + * the variable object and using property attributes { DontDelete } + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.1_Global_Code/S10.2.1_A1_T2.js + * @description Checking if deleting variable x, that is defined as x = 1, fails + * @noStrict + */ + +x = 1; + +if (this.x !== 1) { + $ERROR("#1: variable x is a property of global object"); +} + +if(delete this.x !== true){ + $ERROR("#2: variable x has property attribute DontDelete"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2.1_A1.js b/test/suite/ch10/10.4/10.4.2/S10.4.2.1_A1.js new file mode 100644 index 000000000..764096f5e --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2.1_A1.js @@ -0,0 +1,17 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.4.2.1_A1.js + * @description Strict indirect eval should not leak top level + * declarations into the global scope + * @onlyStrict + */ + +"use strict"; +if (!('foo' in this)) { + (1,eval)('"use strict"; var foo = 88;'); + if ('foo' in this) { + $ERROR("Strict indirect eval leaked a top level declaration"); + } +} diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T1.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T1.js new file mode 100644 index 000000000..392671d41 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T1.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +x = 1; +y = 2; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T10.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T10.js new file mode 100644 index 000000000..b70968fcc --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T10.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T10.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +var x = 1; +var y = 2; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T11.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T11.js new file mode 100644 index 000000000..592c20d57 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T11.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T11.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +this.x = 1; +this.y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T2.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T2.js new file mode 100644 index 000000000..488b9f687 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T2.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +var x = 1; +var y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T3.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T3.js new file mode 100644 index 000000000..2e3154445 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T3.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +this.x = 1; +this.y = 2; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T4.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T4.js new file mode 100644 index 000000000..766f56e0f --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T4.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T4.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +x = 1; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T5.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T5.js new file mode 100644 index 000000000..ae42f8a44 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T5.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T5.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +var x = 1; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +var y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T6.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T6.js new file mode 100644 index 000000000..e2672f2fe --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T6.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T6.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +this.x = 1; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +this.y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T7.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T7.js new file mode 100644 index 000000000..0e8dbd75e --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T7.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T7.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +x = 1; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +var y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T8.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T8.js new file mode 100644 index 000000000..9790ee0be --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T8.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T8.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; +this.x = 1; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +var y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T9.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T9.js new file mode 100644 index 000000000..7c17ef319 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.1_T9.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.1_T9.js + * @description eval within global execution context + */ + +var i; +var j; +str1 = ''; +str2 = ''; + +for(i in this){ + str1+=i; +} + +eval('for(j in this){\nstr2+=j;\n}'); + +if(!(str1 === str2)){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + +x = 1; +y = 2; + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T1.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T1.js new file mode 100644 index 000000000..c15e1c94e --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T1.js @@ -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. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T1.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + x = 1; + y = 2; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + return (str1 === str2); +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T10.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T10.js new file mode 100644 index 000000000..8dfd67ad0 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T10.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T10.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + var x = 1; + var y = 2; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T11.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T11.js new file mode 100644 index 000000000..3e9050a1f --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T11.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T11.js + * @description eval within global execution context + * @noStrict + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + this.x = 1; + this.y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T2.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T2.js new file mode 100644 index 000000000..a369d83f8 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T2.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + var x = 1; + var y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T3.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T3.js new file mode 100644 index 000000000..73fface0f --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T3.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + this.x = 1; + this.y = 2; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T4.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T4.js new file mode 100644 index 000000000..41e682e93 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T4.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T4.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + x = 1; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T5.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T5.js new file mode 100644 index 000000000..167f4c00d --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T5.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T5.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + var x = 1; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + var y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T6.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T6.js new file mode 100644 index 000000000..0287368d4 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T6.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T6.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + this.x = 1; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + this.y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T7.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T7.js new file mode 100644 index 000000000..07793ab96 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T7.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T7.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + x = 1; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + var y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + + + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T8.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T8.js new file mode 100644 index 000000000..78d1e533f --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T8.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T8.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + this.x = 1; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + var y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + + diff --git a/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T9.js b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T9.js new file mode 100644 index 000000000..5f8ee314c --- /dev/null +++ b/test/suite/ch10/10.4/10.4.2/S10.4.2_A1.2_T9.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The scope chain is initialised to contain the same objects, + * in the same order, as the calling context's scope chain + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T9.js + * @description eval within global execution context + */ + +function f(){ + var i; + var j; + str1 = ''; + str2 = ''; + + for(i in this){ + str1+=i; + } + + eval('for(j in this){\nstr2+=j;\n}'); + + return (str1 === str2); + + x = 1; + y = 2; +} + +if(!f()){ + $ERROR("#1: scope chain must contain same objects in the same order as the calling context"); +} + + diff --git a/test/suite/ch10/10.4/10.4.3/S10.4.3_A1.js b/test/suite/ch10/10.4/10.4.3/S10.4.3_A1.js new file mode 100644 index 000000000..3b6f8f8d4 --- /dev/null +++ b/test/suite/ch10/10.4/10.4.3/S10.4.3_A1.js @@ -0,0 +1,16 @@ +// Copyright 2011 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.3_Entering_Function_Code/S10.4.3_A1.js + * @description When calling a strict anonymous function as a + * function, "this" should be bound to undefined. + * @onlyStrict + */ + +"use strict"; +var that = (function() { return this; })(); +if (that !== undefined) { + $ERROR('#1: "this" leaked as: ' + that); +} + diff --git a/test/suite/ch10/10.4/S10.4A1.1_T2.js b/test/suite/ch10/10.4/S10.4A1.1_T2.js new file mode 100644 index 000000000..ff1c394b1 --- /dev/null +++ b/test/suite/ch10/10.4/S10.4A1.1_T2.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Every function call enters a new execution context + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/S10.2_A1.1_T2.js + * @description Recursive function call + */ + +var y; + +function f(a){ + var x; + + if (a === 1) + return x; + else { + if(x === undefined) { + x = 0; + } else { + x = 1; + } + return f(1); + } +} + +y = f(0); + +if(!(y === undefined)){ + $ERROR("#1: Recursive function calls shares execution context"); +} + diff --git a/test/suite/ch10/10.4/S10.4_A1.1_T1.js b/test/suite/ch10/10.4/S10.4_A1.1_T1.js new file mode 100644 index 000000000..87768c693 --- /dev/null +++ b/test/suite/ch10/10.4/S10.4_A1.1_T1.js @@ -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. + +/** + * Every function call enters a new execution context + * + * @path 10_Execution_Contexts/10.4_Establishing_An_Execution_Context/S10.2_A1.1_T1.js + * @description Sequence of function calls + */ + +var y; + +function f(){ + var x; + + if(x === undefined) { + x = 0; + } else { + x = 1; + } + + return x; +} + +y = f(); +y = f(); + +if(!(y === 0)){ + $ERROR("#1: Sequenced function calls shares execution context"); +} + diff --git a/test/suite/ch10/10.6/S10.6_A1.js b/test/suite/ch10/10.6/S10.6_A1.js new file mode 100644 index 000000000..321117de8 --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * When control enters an execution context for function code, + * an arguments object is created and initialised + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A1.js + * @description Executing function which uses arguments object + */ + +//CHECK#1 +function f1(){ + return arguments; +} + +try{ + var x = f1(); +} +catch(e){ + $ERROR("#1: arguments doesn't exists"); +} + +//CHECK#2 +var f2 = function(){ + return arguments; +} + +try{ + var x = f2(); +} +catch(e){ + $ERROR("#2: arguments doesn't exists"); +} + diff --git a/test/suite/ch10/10.6/S10.6_A2.js b/test/suite/ch10/10.6/S10.6_A2.js new file mode 100644 index 000000000..bc0c70d6f --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A2.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The value of the internal [[Prototype]] property of the + * created arguments object is the original Object prototype object, the one + * that is the initial value of Object.prototype + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A2.js + * @description Checking arguments.constructor.prototype===Object.prototype + */ + +//CHECK#1 +function f1(){ + return arguments.constructor.prototype; +} +try{ + if(f1() !== Object.prototype){ + $ERROR('#1: arguments.constructor.prototype === Object.prototype'); + } +} +catch(e){ + $ERROR("#1: arguments doesn't exists"); +} + +//CHECK#2 +var f2 = function(){return arguments.constructor.prototype;}; +try{ + if(f2() !== Object.prototype){ + $ERROR('#2: arguments.constructor.prototype === Object.prototype'); + } +} +catch(e){ + $ERROR("#2: arguments doesn't exists"); +} + diff --git a/test/suite/ch10/10.6/S10.6_A3_T1.js b/test/suite/ch10/10.6/S10.6_A3_T1.js new file mode 100644 index 000000000..ab2834e89 --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A3_T1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name callee with property + * attributes { DontEnum } and no others + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A3_T1.js + * @description Checking existence of arguments.callee property + */ + +//CHECK#1 +function f1(){ + return arguments.hasOwnProperty("callee"); +} +try{ + if(f1() !== true){ + $ERROR("#1: arguments object doesn't contains property 'callee'"); + } +} +catch(e){ + $ERROR("#1: arguments object doesn't exists"); +} + +//CHECK#2 +var f2 = function(){return arguments.hasOwnProperty("callee");}; +try{ + if(f2() !== true){ + $ERROR("#2: arguments object doesn't contains property 'callee'"); + } +} +catch(e){ + $ERROR("#2: arguments object doesn't exists"); +} + diff --git a/test/suite/ch10/10.6/S10.6_A3_T2.js b/test/suite/ch10/10.6/S10.6_A3_T2.js new file mode 100644 index 000000000..a6d8fcb15 --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A3_T2.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name callee with property + * attributes { DontEnum } and no others + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A3_T2.js + * @description Checking if enumerating the arguments.callee property fails + */ + +//CHECK#1 +function f1(){ + for(var x in arguments){ + if (x === "callee"){ + return false; + } + } + return true; +} + +try{ + if(!f1()){ + $ERROR("#1: A property callee don't have attribute { DontEnum }"); + } +} +catch(e){ + $ERROR("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + for(var x in arguments){ + if (x === "callee"){ + return false; + } + } + return true; +} + +try{ + if(!f2()){ + $ERROR("#2: A property callee don't have attribute { DontEnum }"); + } +} +catch(e){ + $ERROR("#2: arguments object don't exists"); +} + diff --git a/test/suite/ch10/10.6/S10.6_A3_T3.js b/test/suite/ch10/10.6/S10.6_A3_T3.js new file mode 100644 index 000000000..e505822c7 --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A3_T3.js @@ -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. + +/** + * A property is created with name callee with property + * attributes { DontEnum } and no others + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A3_T3.js + * @description Checking if deleting arguments.callee property fails + * @noStrict + */ + +//CHECK#1 +function f1(){ + return (delete arguments.callee); +} + +try{ + if(!f1()){ + $ERROR("#1: A property callee have attribute { DontDelete }"); + } +} +catch(e){ + $ERROR("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + return (delete arguments.callee); +} + +try{ + if(!f2()){ + $ERROR("#2: A property callee have attribute { DontDelete }"); + } +} +catch(e){ + $ERROR("#2: arguments object don't exists"); +} + diff --git a/test/suite/ch10/10.6/S10.6_A3_T4.js b/test/suite/ch10/10.6/S10.6_A3_T4.js new file mode 100644 index 000000000..28bc73cdb --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A3_T4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name callee with property + * attributes { DontEnum } and no others + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A3_T4.js + * @description Overriding arguments.callee property + * @noStrict + */ + +var str = "something different"; +//CHECK#1 +function f1(){ + arguments.callee = str; + return arguments; +} + +try{ + if(f1().callee !== str){ + $ERROR("#1: A property callee have attribute { ReadOnly }"); + } +} +catch(e){ + $ERROR("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + arguments.callee = str; + return arguments; + } +try{ + if(f2().callee !== str){ + $ERROR("#2: A property callee have attribute { ReadOnly }"); + } +} +catch(e){ + $ERROR("#2: arguments object don't exists"); +} + diff --git a/test/suite/ch10/10.6/S10.6_A4.js b/test/suite/ch10/10.6/S10.6_A4.js new file mode 100644 index 000000000..036f16820 --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A4.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The initial value of the created property callee is the + * Function object being executed + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A4.js + * @description Checking that arguments.callee === function object + * @noStrict + */ + +//CHECK#1 +function f1(){ + return arguments.callee; +} + +try{ + if(f1 !== f1()){ + $ERROR('#1: arguments.callee === f1'); + } +} +catch(e){ + $ERROR("#1: arguments object doesn't exists"); +} + +//CHECK#2 +var f2 = function(){return arguments.callee;}; + +try{ + if(f2 !== f2()){ + $ERROR('#2: arguments.callee === f2'); + } +} +catch(e){ + $ERROR("#1: arguments object doesn't exists"); +} + diff --git a/test/suite/ch10/10.6/S10.6_A5_T1.js b/test/suite/ch10/10.6/S10.6_A5_T1.js new file mode 100644 index 000000000..0cf170275 --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A5_T1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name length with property + * attributes { DontEnum } and no others + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A5_T1.js + * @description Checking existence of arguments.length property + */ + +//CHECK#1 +function f1(){ + return arguments.hasOwnProperty("length"); +} +try{ + if(f1() !== true){ + $ERROR("#1: arguments object doesn't contains property 'length'"); + } +} +catch(e){ + $ERROR("#1: arguments object doesn't exists"); +} + +//CHECK#2 +var f2 = function(){return arguments.hasOwnProperty("length");}; +try{ + if(f2() !== true){ + $ERROR("#2: arguments object doesn't contains property 'length'"); + } +} +catch(e){ + $ERROR("#2: arguments object doesn't exists"); +} + diff --git a/test/suite/ch10/10.6/S10.6_A5_T2.js b/test/suite/ch10/10.6/S10.6_A5_T2.js new file mode 100644 index 000000000..0420f4cf7 --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A5_T2.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name length with property + * attributes { DontEnum } and no others + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A5_T2.js + * @description Checking if enumerating the arguments.length property fails + */ + +//CHECK#1 +function f1(){ + for(var x in arguments){ + if (x === "length"){ + return false; + } + } + return true; +} + +try{ + if(!f1()){ + $ERROR("#1: A property length don't have attribute { DontEnum }"); + } +} +catch(e){ + $ERROR("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + for(var x in arguments){ + if (x === "length"){ + return false; + } + } + return true; +} + +try{ + if(!f2()){ + $ERROR("#2: A property length don't have attribute { DontEnum }"); + } +} +catch(e){ + $ERROR("#2: arguments object don't exists"); +} + diff --git a/test/suite/ch10/10.6/S10.6_A5_T3.js b/test/suite/ch10/10.6/S10.6_A5_T3.js new file mode 100644 index 000000000..823c557f9 --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A5_T3.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name length with property + * attributes { DontEnum } and no others + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A5_T3.js + * @description Checking if deleting arguments.length property fails + */ + +//CHECK#1 +function f1(){ + return (delete arguments.length); +} + +try{ + if(!f1()){ + $ERROR("#1: A property length have attribute { DontDelete }"); + } +} +catch(e){ + $ERROR("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + return (delete arguments.length); +} + +try{ + if(!f2()){ + $ERROR("#2: A property length have attribute { DontDelete }"); + } +} +catch(e){ + $ERROR("#2: arguments object don't exists"); +} + diff --git a/test/suite/ch10/10.6/S10.6_A5_T4.js b/test/suite/ch10/10.6/S10.6_A5_T4.js new file mode 100644 index 000000000..1e1eec6d4 --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A5_T4.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name length with property + * attributes { DontEnum } and no others + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A5_T4.js + * @description Overriding arguments.length property + */ + +var str = "something different"; +//CHECK#1 +function f1(){ + arguments.length = str; + return arguments; +} + +try{ + if(f1().length !== str){ + $ERROR("#1: A property length have attribute { ReadOnly }"); + } +} +catch(e){ + $ERROR("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + arguments.length = str; + return arguments; + }; +try{ + if(f2().length !== str){ + $ERROR("#2: A property length have attribute { ReadOnly }"); + } +} +catch(e){ + $ERROR("#2: arguments object don't exists"); +} + diff --git a/test/suite/ch10/10.6/S10.6_A6.js b/test/suite/ch10/10.6/S10.6_A6.js new file mode 100644 index 000000000..d219b6610 --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A6.js @@ -0,0 +1,67 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The initial value of the created property length is the number + * of actual parameter values supplied by the caller + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A6.js + * @description Create function, that returned arguments.length + */ + +function f1(){ + return arguments.length; +} + +//CHECK#1 +if(!(f1() === 0)){ + $ERROR('#1: argument.length === 0'); +} + +//CHECK#2 +if(!(f1(0) === 1)){ + $ERROR('#2: argument.length === 1'); +} + +//CHECK#3 +if(!(f1(0, 1) === 2)){ + $ERROR('#3: argument.length === 2'); +} + +//CHECK#4 +if(!(f1(0, 1, 2) === 3)){ + $ERROR('#4: argument.length === 3'); +} + +//CHECK#5 +if(!(f1(0, 1, 2, 3) === 4)){ + $ERROR('#5: argument.length === 4'); +} + +var f2 = function(){return arguments.length;}; + +//CHECK#6 +if(!(f2() === 0)){ + $ERROR('#6: argument.length === 0'); +} + +//CHECK#7 +if(!(f2(0) === 1)){ + $ERROR('#7: argument.length === 1'); +} + +//CHECK#8 +if(!(f2(0, 1) === 2)){ + $ERROR('#8: argument.length === 2'); +} + +//CHECK#9 +if(!(f2(0, 1, 2) === 3)){ + $ERROR('#9: argument.length === 3'); +} + +//CHECK#10 +if(!(f2(0, 1, 2, 3) === 4)){ + $ERROR('#10: argument.length === 4'); +} + diff --git a/test/suite/ch10/10.6/S10.6_A7.js b/test/suite/ch10/10.6/S10.6_A7.js new file mode 100644 index 000000000..700996f7c --- /dev/null +++ b/test/suite/ch10/10.6/S10.6_A7.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Get arguments of function + * + * @path 10_Execution_Contexts/10.6_Arguments_Object/S10.1.8_A7.js + * @description Use property arguments + */ + +function f1() { + return arguments; +} + +//CHECK#1-5 +for(var i = 1; i < 5; i++){ +if (f1(1,2,3,4,5)[i] !== (i+1)) + $ERROR("#"+i+": Returning function's arguments work wrong, f1(1,2,3,4,5)["+i+"] !== "+(i+1)); +} + |