summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/this
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/expressions/this')
-rw-r--r--js/src/tests/test262/language/expressions/this/11.1.1-1.js11
-rw-r--r--js/src/tests/test262/language/expressions/this/S11.1.1_A1.js16
-rw-r--r--js/src/tests/test262/language/expressions/this/S11.1.1_A3.1.js25
-rw-r--r--js/src/tests/test262/language/expressions/this/S11.1.1_A3.2.js24
-rw-r--r--js/src/tests/test262/language/expressions/this/S11.1.1_A4.1.js24
-rw-r--r--js/src/tests/test262/language/expressions/this/S11.1.1_A4.2.js28
-rw-r--r--js/src/tests/test262/language/expressions/this/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/this/shell.js0
8 files changed, 128 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/this/11.1.1-1.js b/js/src/tests/test262/language/expressions/this/11.1.1-1.js
new file mode 100644
index 0000000000..0136301f39
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/this/11.1.1-1.js
@@ -0,0 +1,11 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 11.1.1-1gs
+description: the 'this' object at the global scope is not undefined
+---*/
+
+assert.notSameValue(this, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/this/S11.1.1_A1.js b/js/src/tests/test262/language/expressions/this/S11.1.1_A1.js
new file mode 100644
index 0000000000..3c0d0c179c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/this/S11.1.1_A1.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The "this" is reserved word
+es5id: 11.1.1_A1
+description: Checking if execution of "this=1" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+this = 1;
diff --git a/js/src/tests/test262/language/expressions/this/S11.1.1_A3.1.js b/js/src/tests/test262/language/expressions/this/S11.1.1_A3.1.js
new file mode 100644
index 0000000000..1719872419
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/this/S11.1.1_A3.1.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.
+
+/*---
+info: |
+ Being in function code, "this" and eval("this"), called as a functions,
+ return the global object
+es5id: 11.1.1_A3.1
+description: Creating function which returns "this" or eval("this")
+flags: [noStrict]
+---*/
+
+//CHECK#1
+function ReturnThis() {return this}
+if (ReturnThis() !== this) {
+ throw new Test262Error('#1: function ReturnThis() {return this} ReturnThis() === this. Actual: ' + (ReturnThis()));
+}
+
+//CHECK#2
+function ReturnEvalThis() {return eval("this")}
+if (ReturnEvalThis() !== this) {
+ throw new Test262Error('#2: function ReturnEvalThis() {return eval("this")} ReturnEvalThis() === this. Actual: ' + (ReturnEvalThis()));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/this/S11.1.1_A3.2.js b/js/src/tests/test262/language/expressions/this/S11.1.1_A3.2.js
new file mode 100644
index 0000000000..438e14efed
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/this/S11.1.1_A3.2.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.
+
+/*---
+info: |
+ Being in function code, "this" and eval("this"), called as a
+ constructors, return the object
+es5id: 11.1.1_A3.2
+description: Create function. It have property, that returned "this"
+---*/
+
+//CHECK#1
+function SetThis() {this.THIS = this}
+if ((new SetThis()).THIS.toString() !== "[object Object]") {
+ throw new Test262Error('#1: function SetThis() {this.THIS = this} (new SetThis()).THIS.toString() !== "[object Object]". Actual: ' + ((new SetThis()).THIS.toString()));
+}
+
+//CHECK#2
+function SetEvalThis() {this.THIS = eval("this")}
+if ((new SetEvalThis()).THIS.toString() !== "[object Object]") {
+ throw new Test262Error('#2: function SetEvalThis() {this.THIS = eval("this")} (new SetEvalThis()).THIS.toString() !== "[object Object]". Actual: ' + ((new SetEvalThis()).THIS.toString()));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/this/S11.1.1_A4.1.js b/js/src/tests/test262/language/expressions/this/S11.1.1_A4.1.js
new file mode 100644
index 0000000000..e79314eddc
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/this/S11.1.1_A4.1.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.
+
+/*---
+info: |
+ Being in anonymous code, "this" and eval("this"), called as a function,
+ return the global object
+es5id: 11.1.1_A4.1
+description: Creating function with new Function() constructor
+---*/
+
+//CHECK#1
+var MyFunction = new Function("return this");
+if (MyFunction() !== this) {
+ throw new Test262Error('#1: var MyFunction = new Function("return this"); MyFunction() === this. Actual: ' + (MyFunction()));
+}
+
+//CHECK#2
+MyFunction = new Function("return eval(\'this\')");
+if (MyFunction() !== this) {
+ throw new Test262Error('#2: var MyFunction = new Function("return eval(\'this\')"); MyFunction() === this. Actual: ' + (MyFunction()));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/this/S11.1.1_A4.2.js b/js/src/tests/test262/language/expressions/this/S11.1.1_A4.2.js
new file mode 100644
index 0000000000..7c5a4e6326
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/this/S11.1.1_A4.2.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.
+
+/*---
+info: |
+ Being in anonymous code, "this" and eval("this"), called as a
+ constructor, return the object
+es5id: 11.1.1_A4.2
+description: >
+ Creating function by using new Function() constructor. It has the
+ property, which returns "this"
+---*/
+
+//CHECK#1
+var MyFunction = new Function("this.THIS = this");
+var MyObject = new MyFunction();
+if (MyObject.THIS.toString() !== "[object Object]") {
+ throw new Test262Error('#1: var MyFunction = new Function("this.THIS = this"); var MyObject = new MyFunction(); MyObject.THIS.toString() === "[object Object]". Actual: ' + (MyObject.THIS.toString()));
+}
+
+//CHECK#2
+MyFunction = new Function("this.THIS = eval(\'this\')");
+MyObject = new MyFunction();
+if (MyObject.THIS.toString() !== "[object Object]") {
+ throw new Test262Error('#2: var MyFunction = new Function("this.THIS = eval(\'this\')"); var MyObject = new MyFunction(); MyObject.THIS.toString() === "[object Object]". Actual: ' + (MyObject.THIS.toString()));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/this/browser.js b/js/src/tests/test262/language/expressions/this/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/this/browser.js
diff --git a/js/src/tests/test262/language/expressions/this/shell.js b/js/src/tests/test262/language/expressions/this/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/this/shell.js