summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/ch11/11.1/11.1.1
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/ch11/11.1/11.1.1')
-rw-r--r--js/src/tests/test262/ch11/11.1/11.1.1/11.1.1-1gs.js16
-rw-r--r--js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A1.js13
-rw-r--r--js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A3.1.js25
-rw-r--r--js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A3.2.js24
-rw-r--r--js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.1.js24
-rw-r--r--js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.2.js25
-rw-r--r--js/src/tests/test262/ch11/11.1/11.1.1/browser.js0
-rw-r--r--js/src/tests/test262/ch11/11.1/11.1.1/shell.js0
8 files changed, 127 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/11.1.1-1gs.js b/js/src/tests/test262/ch11/11.1/11.1.1/11.1.1-1gs.js
new file mode 100644
index 000000000..0f2b30b5d
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.1/11.1.1/11.1.1-1gs.js
@@ -0,0 +1,16 @@
+/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+
+/**
+ * @path ch11/11.1/11.1.1/11.1.1-1gs.js
+ * @description Strict Mode - 'this' object at the global scope is not undefined
+ * @onlyStrict
+ */
+
+"use strict";
+if (this===undefined) {
+ throw NotEarlyError;
+}
diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A1.js b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A1.js
new file mode 100644
index 000000000..c68c32736
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A1.js
@@ -0,0 +1,13 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * The "this" is reserved word
+ *
+ * @path ch11/11.1/11.1.1/S11.1.1_A1.js
+ * @description Checking if execution of "this=1" fails
+ * @negative
+ */
+
+this = 1;
+
diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A3.1.js b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A3.1.js
new file mode 100644
index 000000000..4094fa914
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.1/11.1.1/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.
+
+/**
+ * Being in function code, "this" and eval("this"), called as a functions, return the global object
+ *
+ * @path ch11/11.1/11.1.1/S11.1.1_A3.1.js
+ * @description Creating function which returns "this" or eval("this")
+ * @noStrict
+ */
+
+//CHECK#1
+function MyFunction() {return this}
+if (MyFunction() !== this) {
+ $ERROR('#1: function MyFunction() {return this} MyFunction() === this. Actual: ' + (MyFunction()));
+}
+
+//CHECK#2
+function MyFunction() {return eval("this")}
+if (MyFunction() !== this) {
+ $ERROR('#2: function MyFunction() {return eval("this")} MyFunction() === this. Actual: ' + (MyFunction()));
+}
+
+
+
diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A3.2.js b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A3.2.js
new file mode 100644
index 000000000..ca0d5e699
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.1/11.1.1/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.
+
+/**
+ * Being in function code, "this" and eval("this"), called as a constructors, return the object
+ *
+ * @path ch11/11.1/11.1.1/S11.1.1_A3.2.js
+ * @description Create function. It have property, that returned "this"
+ * @noStrict
+ */
+
+//CHECK#1
+function MyFunction() {this.THIS = this}
+if ((new MyFunction()).THIS.toString() !== "[object Object]") {
+ $ERROR('#1: function MyFunction() {this.THIS = this} (new MyFunction()).THIS.toString() !== "[object Object]". Actual: ' + ((new MyFunction()).THIS.toString()));
+}
+
+//CHECK#2
+function MyFunction() {this.THIS = eval("this")}
+if ((new MyFunction()).THIS.toString() !== "[object Object]") {
+ $ERROR('#2: function MyFunction() {this.THIS = eval("this")} (new MyFunction()).THIS.toString() !== "[object Object]". Actual: ' + ((new MyFunction()).THIS.toString()));
+}
+
+
diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.1.js b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.1.js
new file mode 100644
index 000000000..38e2adbbd
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.1/11.1.1/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.
+
+/**
+ * Being in anonymous code, "this" and eval("this"), called as a function, return the global object
+ *
+ * @path ch11/11.1/11.1.1/S11.1.1_A4.1.js
+ * @description Creating function with new Function() constructor
+ */
+
+//CHECK#1
+var MyFunction = new Function("return this");
+if (MyFunction() !== this) {
+ $ERROR('#1: var MyFunction = new Function("return this"); MyFunction() === this. Actual: ' + (MyFunction()));
+}
+
+//CHECK#2
+MyFunction = new Function("return eval(\'this\')");
+if (MyFunction() !== this) {
+ $ERROR('#2: var MyFunction = new Function("return eval(\'this\')"); MyFunction() === this. Actual: ' + (MyFunction()));
+}
+
+
+
diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.2.js b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.2.js
new file mode 100644
index 000000000..cd37d6824
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.1/11.1.1/S11.1.1_A4.2.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.
+
+/**
+ * Being in anonymous code, "this" and eval("this"), called as a constructor, return the object
+ *
+ * @path ch11/11.1/11.1.1/S11.1.1_A4.2.js
+ * @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]") {
+ $ERROR('#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]") {
+ $ERROR('#2: var MyFunction = new Function("this.THIS = eval(\'this\')"); var MyObject = new MyFunction(); MyObject.THIS.toString() === "[object Object]". Actual: ' + (MyObject.THIS.toString()));
+}
+
+
diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/browser.js b/js/src/tests/test262/ch11/11.1/11.1.1/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.1/11.1.1/browser.js
diff --git a/js/src/tests/test262/ch11/11.1/11.1.1/shell.js b/js/src/tests/test262/ch11/11.1/11.1.1/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.1/11.1.1/shell.js