aboutsummaryrefslogtreecommitdiffstats
path: root/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation
diff options
context:
space:
mode:
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation')
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A1.js28
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A2.js35
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A3.js20
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A4_T1.js47
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A4_T2.js40
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A5.1_T1.js34
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A5.1_T2.js34
-rw-r--r--external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A5.2_T1.js33
8 files changed, 271 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A1.js
new file mode 100644
index 000000000..f2aa5c164
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A1.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.
+
+/**
+ * @name: S10.1.3_A1;
+ * @section: 10.1.3;
+ * @assertion: If the caller supplies fewer parameter values than there are
+ * formal parameters, the extra formal parameters have value undefined;
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A2.js
new file mode 100644
index 000000000..ff5c3ac61
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A2.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.
+
+/**
+ * @name: S10.1.3_A2;
+ * @section: 10.1.3;
+ * @assertion: 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;
+ * @description: Creating functions initialized with two or more formal parameters, which have the same name;
+*/
+
+//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/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A3.js
new file mode 100644
index 000000000..da923f14b
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A3.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.
+
+/**
+ * @name: S10.1.3_A3;
+ * @section: 10.1.3;
+ * @assertion: 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;
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A4_T1.js
new file mode 100644
index 000000000..bc556a80d
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A4_T1.js
@@ -0,0 +1,47 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @name: S10.1.3_A4_T1;
+ * @section: 10.1.3;
+ * @assertion: 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;
+ * @description: Checking existence of a function with passed parameter;
+*/
+
+//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/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A4_T2.js
new file mode 100644
index 000000000..9f0fcf281
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A4_T2.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.
+
+/**
+ * @name: S10.1.3_A4_T2;
+ * @section: 10.1.3;
+ * @assertion: 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;
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A5.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A5.1_T1.js
new file mode 100644
index 000000000..a2a487e4e
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A5.1_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.
+
+/**
+ * @name: S10.1.3_A5.1_T1;
+ * @section: 10.1.3;
+ * @assertion: 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;
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A5.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A5.1_T2.js
new file mode 100644
index 000000000..2325854d9
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A5.1_T2.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.
+
+/**
+ * @name: S10.1.3_A5.1_T2;
+ * @section: 10.1.3;
+ * @assertion: 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;
+ * @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/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A5.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A5.2_T1.js
new file mode 100644
index 000000000..f681058c8
--- /dev/null
+++ b/external/contributions/Google/sputniktests/tests/Conformance/10_Execution_Contexts/10.1_Definitions/10.1.3_Variable_Instantiation/S10.1.3_A5.2_T1.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.
+
+/**
+ * @name: S10.1.3_A5.2_T1;
+ * @section: 10.1.3;
+ * @assertion: 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;
+ * @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');
+}