diff options
Diffstat (limited to 'js/src/tests/test262/ch11/11.4')
193 files changed, 5032 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-0-1.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-0-1.js new file mode 100644 index 000000000..2a3407dd5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-0-1.js @@ -0,0 +1,26 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-0-1.js
+ * @description delete operator as UnaryExpression
+ */
+
+
+function testcase() {
+ var x = 1;
+ var y = 2;
+ var z = 3;
+
+ if( (!delete x || delete y) &&
+ delete delete z)
+ {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-1.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-1.js new file mode 100644 index 000000000..223de50d5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-1.js @@ -0,0 +1,18 @@ +/// 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.4/11.4.1/11.4.1-2-1.js
+ * @description delete operator returns true when deleting a non-reference (number)
+ */
+
+
+function testcase() {
+ var d = delete 42;
+ if (d === true) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-2.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-2.js new file mode 100644 index 000000000..eed36f4c5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-2.js @@ -0,0 +1,20 @@ +/// 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.4/11.4.1/11.4.1-2-2.js
+ * @description delete operator returns true when deleting returned value from a function
+ */
+
+
+function testcase() {
+ var bIsFooCalled = false;
+ var foo = function(){bIsFooCalled = true;};
+
+ var d = delete foo();
+ if(d === true && bIsFooCalled === true)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-3.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-3.js new file mode 100644 index 000000000..5d8fc9bce --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-3.js @@ -0,0 +1,18 @@ +/// 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.4/11.4.1/11.4.1-2-3.js
+ * @description delete operator returns true when deleting a non-reference (boolean)
+ */
+
+
+function testcase() {
+ var d = delete true;
+ if (d === true) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-4.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-4.js new file mode 100644 index 000000000..3da874599 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-4.js @@ -0,0 +1,18 @@ +/// 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.4/11.4.1/11.4.1-2-4.js
+ * @description delete operator returns true when deleting a non-reference (string)
+ */
+
+
+function testcase() {
+ var d = delete "abc";
+ if (d === true) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-5.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-5.js new file mode 100644 index 000000000..ae32bebce --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-5.js @@ -0,0 +1,18 @@ +/// 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.4/11.4.1/11.4.1-2-5.js
+ * @description delete operator returns true when deleting a non-reference (obj)
+ */
+
+
+function testcase() {
+ var d = delete {a:0} ;
+ if (d === true) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-6.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-6.js new file mode 100644 index 000000000..bcee797c2 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-2-6.js @@ -0,0 +1,18 @@ +/// 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.4/11.4.1/11.4.1-2-6.js
+ * @description delete operator returns true when deleting a non-reference (null)
+ */
+
+
+function testcase() {
+ var d = delete null;
+ if (d === true) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-3-1.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-3-1.js new file mode 100644 index 000000000..9ae258064 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-3-1.js @@ -0,0 +1,19 @@ +/// 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.4/11.4.1/11.4.1-3-1.js
+ * @description delete operator returns true when deleting an unresolvable reference
+ */
+
+
+function testcase() {
+ // just cooking up a long/veryLikely unique name
+ var d = delete __ES3_1_test_suite_test_11_4_1_3_unique_id_0__;
+ if (d === true) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-3-2.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-3-2.js new file mode 100644 index 000000000..fefff3071 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-3-2.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-3-2.js
+ * @description delete operator throws ReferenceError when deleting an explicitly qualified yet unresolvable reference (base obj undefined)
+ */
+
+
+function testcase() {
+ // just cooking up a long/veryLikely unique name
+ try
+ {
+ var d = delete __ES3_1_test_suite_test_11_4_1_3_unique_id_2__.x;
+ }
+ catch(e)
+ {
+ if (e instanceof ReferenceError)
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-3-3.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-3-3.js new file mode 100644 index 000000000..1f70cca92 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-3-3.js @@ -0,0 +1,19 @@ +/// 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.4/11.4.1/11.4.1-3-3.js
+ * @description delete operator returns true when deleting an explicitly qualified yet unresolvable reference (property undefined for base obj)
+ */
+
+
+function testcase() {
+ var __ES3_1_test_suite_test_11_4_1_3_unique_id_3__ = {};
+ var d = delete __ES3_1_test_suite_test_11_4_1_3_unique_id_3__.x;
+ if (d === true) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-3-a-1-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-3-a-1-s.js new file mode 100644 index 000000000..7172421d0 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-3-a-1-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.1/11.4.1-3-a-1-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting an un-resolvable reference
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("delete obj");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4-a-1-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4-a-1-s.js new file mode 100644 index 000000000..82c586a1f --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4-a-1-s.js @@ -0,0 +1,28 @@ +/// 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.4/11.4.1/11.4.1-4-a-1-s.js
+ * @description Strict Mode - TypeError is thrown when deleting non-configurable data property
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var obj = {};
+ Object.defineProperty(obj, "prop", {
+ value: "abc",
+ configurable: false
+ });
+
+ try {
+ delete obj.prop;
+ return false;
+ } catch (e) {
+ return e instanceof TypeError && obj.prop === "abc";
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4-a-2-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4-a-2-s.js new file mode 100644 index 000000000..135f01295 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4-a-2-s.js @@ -0,0 +1,30 @@ +/// 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.4/11.4.1/11.4.1-4-a-2-s.js
+ * @description Strict Mode - TypeError is thrown when deleting non-configurable accessor property
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var obj = {};
+ Object.defineProperty(obj, "prop", {
+ get: function () {
+ return "abc";
+ },
+ configurable: false
+ });
+
+ try {
+ delete obj.prop;
+ return false;
+ } catch (e) {
+ return e instanceof TypeError && obj.prop === "abc";
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4-a-3-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4-a-3-s.js new file mode 100644 index 000000000..85bc8b2d7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4-a-3-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-4-a-3-s.js
+ * @description Strict Mode - TypeError isn't thrown when deleting configurable data property
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var obj = {};
+ Object.defineProperty(obj, "prop", {
+ value: "abc",
+ configurable: true
+ });
+
+ delete obj.prop;
+ return !obj.hasOwnProperty("prop");
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4-a-4-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4-a-4-s.js new file mode 100644 index 000000000..6ce81cfbc --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4-a-4-s.js @@ -0,0 +1,26 @@ +/// 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.4/11.4.1/11.4.1-4-a-4-s.js
+ * @description Strict Mode - TypeError isn't thrown when deleting configurable accessor property
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var obj = {};
+ Object.defineProperty(obj, "prop", {
+ get: function () {
+ return "abc";
+ },
+ configurable: true
+ });
+
+ delete obj.prop;
+ return !obj.hasOwnProperty("prop");
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-1.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-1.js new file mode 100644 index 000000000..0ed36af96 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-1.js @@ -0,0 +1,26 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-1.js
+ * @description delete operator returns true when deleting a configurable data property
+ */
+
+
+function testcase() {
+ var o = {};
+
+ var desc = { value: 1, configurable: true };
+ Object.defineProperty(o, "foo", desc);
+
+ var d = delete o.foo;
+ if (d === true && o.hasOwnProperty("foo") === false) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-10.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-10.js new file mode 100644 index 000000000..7a515d725 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-10.js @@ -0,0 +1,33 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-10.js
+ * @description delete operator returns true for property (stringify) defined on built-in object (JSON)
+ */
+
+
+function testcase() {
+ try {
+ var o = JSON.stringify;
+ var desc;
+ try {
+ desc = Object.getOwnPropertyDescriptor(JSON, 'stringify')
+ }
+ catch (e) {
+ };
+ var d = delete JSON.stringify;
+ if (d === true && JSON.stringify === undefined) {
+ return true;
+ }
+ } finally {
+ if (desc) Object.defineProperty(JSON, 'stringify', desc)
+ else JSON.stringify = o /* this branch messes up the attributes */;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-11.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-11.js new file mode 100644 index 000000000..b46af9f74 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-11.js @@ -0,0 +1,24 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-11.js
+ * @description delete operator returns true on deleting arguments propterties(arguments.callee)
+ */
+
+
+function testcase() {
+ function foo(a,b)
+ {
+ return (delete arguments.callee);
+ }
+ var d = delete arguments.callee;
+ if(d === true && arguments.callee === undefined)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-12.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-12.js new file mode 100644 index 000000000..5cc30983c --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-12.js @@ -0,0 +1,23 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-12.js
+ * @description delete operator returns false when deleting a property(length)
+ */
+
+
+function testcase() {
+
+ var a = [1,2,3]
+ a.x = 10;
+ var d = delete a.length
+ if(d === false && a.length === 3)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-13.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-13.js new file mode 100644 index 000000000..5156957ed --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-13.js @@ -0,0 +1,25 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-13.js
+ * @description delete operator returns false when deleting Array object
+ */
+
+
+function testcase() {
+
+ var a = [1,2,3]
+ a.x = 10;
+
+ var d = delete a
+
+ if(d === false && Array.isArray(a) === true)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-14.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-14.js new file mode 100644 index 000000000..288d25ec0 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-14.js @@ -0,0 +1,23 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-14.js
+ * @description delete operator returns true when deleting Array elements
+ */
+
+
+function testcase() {
+
+ var a = [1,2,3]
+ a.x = 10;
+ var d = delete a[1]
+ if(d === true && a[1] === undefined)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-15.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-15.js new file mode 100644 index 000000000..98a6d6c08 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-15.js @@ -0,0 +1,23 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-15.js
+ * @description delete operator returns true when deleting Array expandos
+ */
+
+
+function testcase() {
+
+ var a = [1,2,3]
+ a.x = 10;
+ var d = delete a.x;
+ if( d === true && a.x === undefined)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-16.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-16.js new file mode 100644 index 000000000..01873811f --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-16.js @@ -0,0 +1,20 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-16.js
+ * @description delete operator returns false on deleting arguments object
+ */
+
+
+function testcase() {
+
+ if(delete arguments === false && arguments !== undefined)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-17.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-17.js new file mode 100644 index 000000000..97f0e0ab9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-17.js @@ -0,0 +1,25 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-17.js
+ * @description delete operator returns true on deleting a arguments element
+ */
+
+
+function testcase() {
+ function foo(a,b)
+ {
+ var d = delete arguments[0];
+ return (d === true && arguments[0] === undefined);
+ }
+
+ if(foo(1,2) === true)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-2.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-2.js new file mode 100644 index 000000000..be165f1f1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-2.js @@ -0,0 +1,29 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-2.js
+ * @description delete operator returns true when deleting a configurable accessor property
+ */
+
+
+function testcase() {
+ var o = {};
+
+ // define an accessor
+ // dummy getter
+ var getter = function () { return 1; }
+ var desc = { get: getter, configurable: true };
+ Object.defineProperty(o, "foo", desc);
+
+ var d = delete o.foo;
+ if (d === true && o.hasOwnProperty("foo") === false) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-3-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-3-s.js new file mode 100644 index 000000000..85e5c23db --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-3-s.js @@ -0,0 +1,32 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-3-s.js
+ * @description delete operator throws TypeError when deleting a non-configurable data property in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ var o = {};
+ var desc = { value : 1 }; // all other attributes default to false
+ Object.defineProperty(o, "foo", desc);
+
+ // Now, deleting o.foo should throw TypeError because [[Configurable]] on foo is false.
+ try {
+ delete o.foo;
+ return false;
+ }
+ catch (e) {
+ return (e instanceof TypeError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-3.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-3.js new file mode 100644 index 000000000..25f9bc7d0 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-3.js @@ -0,0 +1,26 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-3.js
+ * @description delete operator returns false when deleting a non-configurable data property
+ */
+
+
+function testcase() {
+ var o = {};
+ var desc = { value : 1, configurable: false }; // all other attributes default to false
+ Object.defineProperty(o, "foo", desc);
+
+ // Now, deleting o.foo should fail because [[Configurable]] on foo is false.
+ var d = delete o.foo;
+ if (d === false && o.hasOwnProperty("foo") === true) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-4.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-4.js new file mode 100644 index 000000000..98f2496f9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-4.js @@ -0,0 +1,22 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-4.js
+ * @description delete operator returns false when deleting a non-configurable data property (NaN)
+ */
+
+
+function testcase() {
+ // NaN (15.1.1.1) has [[Configurable]] set to false.
+ var d = delete NaN;
+ if (d === false) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-5.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-5.js new file mode 100644 index 000000000..0585bb3c4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-5.js @@ -0,0 +1,28 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-5.js
+ * @description delete operator returns false when deleting the environment object inside 'with'
+ */
+
+
+function testcase() {
+ var o = new Object();
+ o.x = 1;
+ var d;
+ with(o)
+ {
+ d = delete o;
+ }
+ if (d === false && typeof(o) === 'object' && o.x === 1) {
+ return true;
+ }
+ return false;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-6.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-6.js new file mode 100644 index 000000000..a5194837f --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-6.js @@ -0,0 +1,27 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-6.js
+ * @description delete operator returns true when deleting a property inside 'with'
+ */
+
+
+function testcase() {
+ var o = new Object();
+ o.x = 1;
+ var d;
+ with(o)
+ {
+ d = delete x;
+ }
+ if (d === true && o.x === undefined) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-7.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-7.js new file mode 100644 index 000000000..85bbe995d --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-7.js @@ -0,0 +1,23 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-7.js
+ * @description delete operator inside 'eval'
+ */
+
+
+function testcase() {
+ var x = 1;
+ var d = eval("delete x");
+ if (d === false && x === 1) {
+ return true;
+ }
+ return false;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-8-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-8-s.js new file mode 100644 index 000000000..c73f8d833 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-8-s.js @@ -0,0 +1,28 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-8-s.js
+ * @description delete operator throws TypeError when deleting a non-configurable data property in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ // NaN (15.1.1.1) has [[Configurable]] set to false.
+ try {
+ delete fnGlobalObject().NaN;
+ return false;
+ }
+ catch (e) {
+ return (e instanceof TypeError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-8.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-8.js new file mode 100644 index 000000000..0d6da1a80 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-8.js @@ -0,0 +1,26 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-8.js
+ * @description delete operator returns true for built-in objects (JSON)
+ */
+
+
+function testcase() {
+ try {
+ var o = JSON;
+ var d = delete JSON;
+ if (d === true) {
+ return true;
+ }
+ } finally {
+ JSON = o;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-9-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-9-s.js new file mode 100644 index 000000000..da7a464ba --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-9-s.js @@ -0,0 +1,27 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-9-s.js
+ * @description delete operator throws TypeError when deleting a non-configurable data property (Math.LN2) in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ try {
+ delete Math.LN2;
+ return false;
+ }
+ catch (e) {
+ return (e instanceof TypeError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-9.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-9.js new file mode 100644 index 000000000..472fdc0c8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-4.a-9.js @@ -0,0 +1,21 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.1-4.a-9.js
+ * @description delete operator returns false when deleting a non-configurable data property (Math.LN2)
+ */
+
+
+function testcase() {
+ var d = delete Math.LN2;
+ if (d === false) {
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-1.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-1.js new file mode 100644 index 000000000..c4de1ba6f --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-1.js @@ -0,0 +1,20 @@ +/// 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.4/11.4.1/11.4.1-5-1.js
+ * @description delete operator returns false when deleting a direct reference to a var
+ */
+
+
+function testcase() {
+ var x = 1;
+
+ // Now, deleting 'x' directly should fail;
+ var d = delete x;
+ if(d === false && x === 1)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-2.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-2.js new file mode 100644 index 000000000..838b653b1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-2.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.1/11.4.1-5-2.js
+ * @description delete operator returns false when deleting a direct reference to a function argument
+ */
+
+
+function testcase() {
+
+ function foo(a,b) {
+
+ // Now, deleting 'a' directly should fail
+ // because 'a' is direct reference to a function argument;
+ var d = delete a;
+ return (d === false && a === 1);
+ }
+ return foo(1,2);
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-3.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-3.js new file mode 100644 index 000000000..33efcdb3e --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-3.js @@ -0,0 +1,20 @@ +/// 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.4/11.4.1/11.4.1-5-3.js
+ * @description delete operator returns false when deleting a direct reference to a function name
+ */
+
+
+function testcase() {
+ var foo = function(){};
+
+ // Now, deleting 'foo' directly should fail;
+ var d = delete foo;
+ if(d === false && fnExists(foo))
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-1-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-1-s.js new file mode 100644 index 000000000..3235f6aff --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-1-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-1-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable which is a primitive value type (number)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var _11_4_1_5 = 5;
+
+ try {
+ eval("delete _11_4_1_5;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-10-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-10-s.js new file mode 100644 index 000000000..6d614fb99 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-10-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-10-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable of type Array
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var arrObj = [1,2,3];
+
+ try {
+ eval("delete arrObj;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-11-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-11-s.js new file mode 100644 index 000000000..328b4926f --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-11-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-11-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable of type String
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var strObj = new String("abc");
+
+ try {
+ eval("delete strObj;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-12-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-12-s.js new file mode 100644 index 000000000..e09226b1d --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-12-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-12-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable of type Boolean
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var boolObj = new Boolean(false);
+
+ try {
+ eval("delete boolObj;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-13-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-13-s.js new file mode 100644 index 000000000..008466068 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-13-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-13-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable of type Number
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var numObj = new Number(0);
+
+ try {
+ eval("delete numObj;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-14-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-14-s.js new file mode 100644 index 000000000..8d6770b27 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-14-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-14-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable of type Date
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var dateObj = new Date();
+
+ try {
+ eval("delete dateObj;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-15-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-15-s.js new file mode 100644 index 000000000..3ce568c6a --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-15-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-15-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable of type RegExp
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var regObj = new RegExp();
+
+ try {
+ eval("delete regObj;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-16-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-16-s.js new file mode 100644 index 000000000..0edd4401f --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-16-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-16-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable of type Error
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var errObj = new Error();
+
+ try {
+ eval("delete errObj;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-17-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-17-s.js new file mode 100644 index 000000000..2cb8fedef --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-17-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.1/11.4.1-5-a-17-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable of type Arguments
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ try {
+ eval("var argObj = (function (a, b) { delete arguments; }(1, 2));");
+
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-18-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-18-s.js new file mode 100644 index 000000000..d26819ff7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-18-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.1/11.4.1-5-a-18-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a built-in (Object)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("delete Object;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-19-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-19-s.js new file mode 100644 index 000000000..c45a701b0 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-19-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.1/11.4.1-5-a-19-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a built-in (Function)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("delete Function;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-2-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-2-s.js new file mode 100644 index 000000000..aa5290faa --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-2-s.js @@ -0,0 +1,26 @@ +/// 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.4/11.4.1/11.4.1-5-a-2-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a function parameter
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ function funObj(x) {
+ eval("delete x;");
+ }
+
+ try {
+ funObj(1);
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-20-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-20-s.js new file mode 100644 index 000000000..cf683589c --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-20-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.1/11.4.1-5-a-20-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a built-in (Array)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("delete Array;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-21-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-21-s.js new file mode 100644 index 000000000..994e6ff96 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-21-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.1/11.4.1-5-a-21-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a built-in (String)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("delete String;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-22-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-22-s.js new file mode 100644 index 000000000..341062b03 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-22-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.1/11.4.1-5-a-22-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a built-in (Boolean)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("delete Boolean;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-23-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-23-s.js new file mode 100644 index 000000000..b0302df8b --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-23-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.1/11.4.1-5-a-23-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a built-in (Number)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("delete Number;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-24-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-24-s.js new file mode 100644 index 000000000..0f03df1a7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-24-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.1/11.4.1-5-a-24-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a built-in (Date)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("delete Date;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-25-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-25-s.js new file mode 100644 index 000000000..0f418645a --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-25-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.1/11.4.1-5-a-25-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a built-in (RegExp)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("delete RegExp;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-26-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-26-s.js new file mode 100644 index 000000000..62ed21fc3 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-26-s.js @@ -0,0 +1,26 @@ +/// 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.4/11.4.1/11.4.1-5-a-26-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a built-in (Error)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var errorBackup = Error;
+ try {
+ eval("delete Error;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ } finally {
+ Error = errorBackup;
+ }
+
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-27-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-27-s.js new file mode 100644 index 000000000..4dacb29bd --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-27-s.js @@ -0,0 +1,25 @@ +/// 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.4/11.4.1/11.4.1-5-a-27-s.js
+ * @description Strict Mode - TypeError is thrown after deleting a property, calling preventExtensions, and attempting to reassign the property
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var a = {x:0, get y() { return 0;}};
+ delete a.x;
+ Object.preventExtensions(a);
+ try {
+ a.x = 1;
+ return false;
+ } catch (e) {
+ return e instanceof TypeError;
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-28-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-28-s.js new file mode 100644 index 000000000..4a5e015c3 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-28-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.1/11.4.1-5-a-28-s.js
+ * @description Strict Mode - TypeError is thrown when deleting RegExp.length
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var a = new RegExp();
+ try {
+ var b = delete RegExp.length;
+ return false;
+ } catch (e) {
+ return e instanceof TypeError;
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-3-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-3-s.js new file mode 100644 index 000000000..3c1e18390 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-3-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-3-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a function name
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ function funObj () { }
+
+ try {
+ eval("delete funObj");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-4-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-4-s.js new file mode 100644 index 000000000..55bca492b --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-4-s.js @@ -0,0 +1,26 @@ +/// 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.4/11.4.1/11.4.1-5-a-4-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a function parameter
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ function funObj(x, y, z) {
+ eval("delete y;");
+ }
+
+ try {
+ funObj(1);
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-5-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-5-s.js new file mode 100644 index 000000000..4e72bc917 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-5-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-5-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable which is a primitive type (boolean)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var _11_4_1_5 = true;
+
+ try {
+ eval("delete _11_4_1_5;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-5gs.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-5gs.js new file mode 100644 index 000000000..ed126f668 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-5gs.js @@ -0,0 +1,15 @@ +/// 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.4/11.4.1/11.4.1-5-a-5gs.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable which is primitive type(boolean)
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+"use strict";
+var _11_4_1_5 = 7;
+throw NotEarlyError;
+delete _11_4_1_5;
\ No newline at end of file diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-6-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-6-s.js new file mode 100644 index 000000000..f428dfeb6 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-6-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-6-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable which is a primitive type (string)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var _11_4_1_5 = "abc";
+
+ try {
+ eval("delete _11_4_1_5;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-7-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-7-s.js new file mode 100644 index 000000000..090276fd7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-7-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-7-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable of type Object
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var obj = new Object();
+
+ try {
+ eval("delete obj;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-8-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-8-s.js new file mode 100644 index 000000000..3116d6bc7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-8-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-8-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a function object
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var funObj = function () { };
+
+ try {
+ eval("delete funObj;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-9-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-9-s.js new file mode 100644 index 000000000..45b626551 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.1-5-a-9-s.js @@ -0,0 +1,24 @@ +/// 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.4/11.4.1/11.4.1-5-a-9-s.js
+ * @description Strict Mode - SyntaxError is thrown when deleting a variable of type function (declaration)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ function funObj () { };
+
+ try {
+ eval("delete funObj;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/11.4.4-4.a-3-s.js b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.4-4.a-3-s.js new file mode 100644 index 000000000..109216dea --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/11.4.4-4.a-3-s.js @@ -0,0 +1,32 @@ +/// 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.
+/**
+ * This test is actually testing the [[Delete]] internal method (8.12.8). Since the
+ * language provides no way to directly exercise [[Delete]], the tests are placed here.
+ *
+ * @path ch11/11.4/11.4.1/11.4.4-4.a-3-s.js
+ * @description delete operator throws TypeError when deleting a non-configurable data property in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ var o = {};
+ var desc = { value : 1 }; // all other attributes default to false
+ Object.defineProperty(o, "foo", desc);
+
+ // Now, deleting o.foo should throw TypeError because [[Configurable]] on foo is false.
+ try {
+ delete o.foo;
+ return false;
+ }
+ catch (e) {
+ return (e instanceof TypeError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A1.js b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A1.js new file mode 100644 index 000000000..35764288f --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A1.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. + +/** + * White Space and Line Terminator between "delete" and UnaryExpression are allowed + * + * @path ch11/11.4/11.4.1/S11.4.1_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("delete\u00090") !== true) { + $ERROR('#1: delete\\u00090 === true'); +} + +//CHECK#2 +if (eval("delete\u000B0") !== true) { + $ERROR('#2: delete\\u000B0 === true'); +} + +//CHECK#3 +if (eval("delete\u000C0") !== true) { + $ERROR('#3: delete\\u000C0 === true'); +} + +//CHECK#4 +if (eval("delete\u00200") !== true) { + $ERROR('#4: delete\\u00200 === true'); +} + +//CHECK#5 +if (eval("delete\u00A00") !== true) { + $ERROR('#5: delete\\u00A00 === true'); +} + +//CHECK#6 +if (eval("delete\u000A0") !== true) { + $ERROR('#6: delete\\u000A0 === true'); +} + +//CHECK#7 +if (eval("delete\u000D0") !== true) { + $ERROR('#7: delete\\u000D0 === true'); +} + +//CHECK#8 +if (eval("delete\u20280") !== true) { + $ERROR('#8: delete\\u20280 === true'); +} + +//CHECK#9 +if (eval("delete\u20290") !== true) { + $ERROR('#9: delete\\u20290 === true'); +} + +//CHECK#10 +if (eval("delete\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20290") !== true) { + $ERROR('#10: delete\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20290 === true'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A2.1.js b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A2.1.js new file mode 100644 index 000000000..b993e4a9d --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A2.1.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 Type(x) is not Reference, return true + * + * @path ch11/11.4/11.4.1/S11.4.1_A2.1.js + * @description Checking primitive value and Object value cases + */ + +//CHECK#1 +if (delete 1 !== true) { + $ERROR('#1: delete 1 === true'); +} + +//CHECK#2 +if (delete new Object() !== true) { + $ERROR('#2: delete new Object() === true'); +} + + diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A2.2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A2.2_T1.js new file mode 100644 index 000000000..97fd10939 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A2.2_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. + +/** + * If GetBase(x) doesn't have a property GetPropertyName(x), return true + * + * @path ch11/11.4/11.4.1/S11.4.1_A2.2_T1.js + * @description Checking undeclared variable case + */ + +//CHECK#1 +if (delete x !== true) { + $ERROR('#1: delete x === true'); +} + +//CHECK#2 +if (delete this.x !== true) { + $ERROR('#2: delete this.x === true'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A2.2_T2.js b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A2.2_T2.js new file mode 100644 index 000000000..e5c0cbe54 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A2.2_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If GetBase(x) doesn't have a property GetPropertyName(x), return true + * + * @path ch11/11.4/11.4.1/S11.4.1_A2.2_T2.js + * @description Checking Object object and Function object cases + */ + +//CHECK#1 +function MyFunction(){} +var MyObject = new MyFunction(); +if (delete MyObject.prop !== true) { + $ERROR('#1: function MyFunction(){}; var MyObject = new MyFunction(); delete MyObject.prop === true'); +} + +//CHECK#2 +var MyObject = new Object(); +if (delete MyObject.prop !== true) { + $ERROR('#2: var MyObject = new Object(); delete MyObject.prop === true'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A3.1.js b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A3.1.js new file mode 100644 index 000000000..b1edccca9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A3.1.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. + +/** + * If the property has the DontDelete attribute, return false + * + * @path ch11/11.4/11.4.1/S11.4.1_A3.1.js + * @description Checking declared variable + */ + +//CHECK#1 +var x = 1; +if (delete x !== false) { + $ERROR('#1: var x = 1; delete x === false'); +} + +//CHECK#2 +var y = 1; +if (delete this.y !== false) { + $ERROR('#2: var y = 1; delete this.y === false'); +} + +//CHECK#3 +function MyFunction(){}; +if (delete MyFunction !== false) { + $ERROR('#3: function MyFunction(){}; delete MyFunction === false'); +} + +//CHECK#4 +function MyFunction(){}; +var MyObject = new MyFunction(); +if (delete MyObject !== false) { + $ERROR('#4: function MyFunction(){}; var MyObject = new MyFunction(); delete MyObject === false'); +} + +//CHECK#5 +if (delete MyObject !== false) { + $ERROR('#5: function MyFunction(){}; var MyObject = new MyFunction(); delete MyObject === false'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A3.2.js b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A3.2.js new file mode 100644 index 000000000..bee091183 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A3.2.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. + +/** + * If the property doesn't have the DontDelete attribute, return true + * + * @path ch11/11.4/11.4.1/S11.4.1_A3.2.js + * @description Checking declared variable + */ + +//CHECK#1 +x = 1; +if (delete x !== true) { + $ERROR('#1: x = 1; delete x === true'); +} + +//CHECK#2 +function MyFunction(){}; +MyFunction.prop = 1; +if (delete MyFunction.prop !== true) { + $ERROR('#2: function MyFunction(){}; MyFunction.prop = 1; delete MyFunction.prop === true'); +} + +//CHECK#3 +function MyFunction(){}; +var MyObject = new MyFunction(); +MyObject.prop = 1; +if (delete MyObject.prop !== true) { + $ERROR('#3: function MyFunction(){}; var MyObject = new MyFunction(); MyFunction.prop = 1; delete MyObject.prop === true'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A3.3.js b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A3.3.js new file mode 100644 index 000000000..e396ee626 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A3.3.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If the property doesn't have the DontDelete attribute, remove the property + * + * @path ch11/11.4/11.4.1/S11.4.1_A3.3.js + * @description Checking declared variable + */ + +//CHECK#1 +try { + x = 1; + delete x; + x; + $ERROR('#1: x = 1; delete x; x is not exist'); +} catch (e) { + if (e instanceof ReferenceError !== true) { + $ERROR('#1: x = 1; delete x; x is not exist'); + } +} + + +//CHECK#2 +function MyFunction(){}; +MyFunction.prop = 1; +delete MyFunction.prop; +if (MyFunction.prop !== undefined) { + $ERROR('#2: function MyFunction(){}; MyFunction.prop = 1; delete MyFunction.prop; MyFunction.prop === undefined. Actual: ' + (MyFunction.prop)); + +} + +//CHECK#3 +function MyFunction(){}; +var MyObjectVar = new MyFunction(); +MyObjectVar.prop = 1; +delete MyObjectVar.prop; +if (MyObjectVar.prop !== undefined) { + $ERROR('#3: function MyFunction(){}; var MyObjectVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectVar.prop; MyObjectVar.prop === undefined. Actual: ' + (MyObjectVar.prop)); +} + +//CHECK#4 +if (delete MyObjectVar !== false) { + $ERROR('#4: function MyFunction(){}; var MyObjectVar = new MyFunction(); delete MyObjectVar === false'); +} + +//CHECK#5 +function MyFunction(){}; +MyObjectNotVar = new MyFunction(); +MyObjectNotVar.prop = 1; +delete MyObjectNotVar.prop; +if (MyObjectNotVar.prop !== undefined) { + $ERROR('#5: function MyFunction(){}; MyObjectNotVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectNotVar.prop; MyObjectNotVar.prop === undefined. Actual: ' + (MyObjectNotVar.prop)); +} + +//CHECK#6 +if (delete MyObjectNotVar !== true) { + $ERROR('#6: function MyFunction(){}; var MyObjectNotVar = new MyFunction(); delete MyObjectNotVar === true'); +} + + diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A4.js b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A4.js new file mode 100644 index 000000000..a534ce959 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A4.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "Delete" operator removes property, which is reference to the object, not the object + * + * @path ch11/11.4/11.4.1/S11.4.1_A4.js + * @description Checking two reference by one object + */ + +//CHECK#1 +var obj = new Object(); +var ref = obj; +delete ref; +if (typeof obj !== "object") { + $ERROR('#1: obj = new Object(); ref = obj; delete ref; typeof obj === "object". Actual: ' + (typeof obj)); +} + + diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A5.js b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A5.js new file mode 100644 index 000000000..2fd5f5243 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A5.js @@ -0,0 +1,35 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A strict delete should either succeed, returning true, or it + * should fail by throwing a TypeError. Under no circumstances + * should a strict delete return false. + * + * @path ch11/11.4/11.4.1/S11.4.1_A5.js + * @description See if a strict delete returns false when deleting a + * non-standard property. + * @onlyStrict + */ + +"use strict"; + +var reNames = Object.getOwnPropertyNames(RegExp); +for (var i = 0, len = reNames.length; i < len; i++) { + var reName = reNames[i]; + if (reName !== 'prototype') { + var deleted = 'unassigned'; + try { + deleted = delete RegExp[reName]; + } catch (err) { + if (!(err instanceof TypeError)) { + $ERROR('#1: strict delete threw a non-TypeError: ' + err); + } + // fall through + } + if (deleted === false) { + $ERROR('#2: Strict delete returned false'); + } + } +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/browser.js b/js/src/tests/test262/ch11/11.4/11.4.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/browser.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.1/shell.js b/js/src/tests/test262/ch11/11.4/11.4.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.1/shell.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A1.js b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A1.js new file mode 100644 index 000000000..6211fc242 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A1.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. + +/** + * White Space and Line Terminator between "void" and UnaryExpression are allowed + * + * @path ch11/11.4/11.4.2/S11.4.2_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("void\u00090") !== undefined) { + $ERROR('#1: void\\u00090 === undefined'); +} + +//CHECK#2 +if (eval("void\u000B0") !== undefined) { + $ERROR('#2: void\\u000B0 === undefined'); +} + +//CHECK#3 +if (eval("void\u000C0") !== undefined) { + $ERROR('#3: void\\u000C0 === undefined'); +} + +//CHECK#4 +if (eval("void\u00200") !== undefined) { + $ERROR('#4: void\\u00200 === undefined'); +} + +//CHECK#5 +if (eval("void\u00A00") !== undefined) { + $ERROR('#5: void\\u00A00 === undefined'); +} + +//CHECK#6 +if (eval("void\u000A0") !== undefined) { + $ERROR('#6: void\\u000A0 === undefined'); +} + +//CHECK#7 +if (eval("void\u000D0") !== undefined) { + $ERROR('#7: void\\u000D0 === undefined'); +} + +//CHECK#8 +if (eval("void\u20280") !== undefined) { + $ERROR('#8: void\\u20280 === undefined'); +} + +//CHECK#9 +if (eval("void\u20290") !== undefined) { + $ERROR('#9: void\\u20290 === undefined'); +} + +//CHECK#10 +if (eval("void\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20290") !== undefined) { + $ERROR('#10: void\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20290 === undefined'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A2_T1.js new file mode 100644 index 000000000..bb2ba2a9d --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A2_T1.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. + +/** + * Operator "void" uses GetValue + * + * @path ch11/11.4/11.4.2/S11.4.2_A2_T1.js + * @description Either Type(x) is not Reference or GetBase(x) is not null + */ + +//CHECK#1 +if (void 0 !== undefined) { + $ERROR('#1: void 0 === undefined. Actual: ' + (void 0)); +} + +//CHECK#2 +var x = 0; +if (void x !== undefined) { + $ERROR('#2: var x = 0; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#3 +var x = new Object(); +if (void x !== undefined) { + $ERROR('#3: var x = new Object(); void x === undefined. Actual: ' + (void x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A2_T2.js b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A2_T2.js new file mode 100644 index 000000000..a6074837a --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A2_T2.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator "void" uses GetValue + * + * @path ch11/11.4/11.4.2/S11.4.2_A2_T2.js + * @description If GetBase(x) is null, throw ReferenceError + * @negative + */ + +//CHECK#1 +void x; + diff --git a/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T1.js b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T1.js new file mode 100644 index 000000000..169eeb6c8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_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. + +/** + * Operator "void" evaluates UnaryExpression and returns undefined + * + * @path ch11/11.4/11.4.2/S11.4.2_A4_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +var x = false; +if (void x !== undefined) { + $ERROR('#1: var x = false; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = new Boolean(true); +if (void x !== undefined) { + $ERROR('#2: var x = new Boolean(true); void x === undefined. Actual: ' + (void x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T2.js b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T2.js new file mode 100644 index 000000000..0175474af --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_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. + +/** + * Operator "void" evaluates UnaryExpression and returns undefined + * + * @path ch11/11.4/11.4.2/S11.4.2_A4_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +var x = 0.1; +if (void x !== undefined) { + $ERROR('#1: var x = 0.1; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = new Number(-1.1); +if (void x !== undefined) { + $ERROR('#2: var x = new Number(-1.1); void x === undefined. Actual: ' + (void x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T3.js b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T3.js new file mode 100644 index 000000000..884b84af4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_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. + +/** + * Operator "void" evaluates UnaryExpression and returns undefined + * + * @path ch11/11.4/11.4.2/S11.4.2_A4_T3.js + * @description Type(x) is string primitive of String object + */ + +//CHECK#1 +var x = "1"; +if (void x !== undefined) { + $ERROR('#1: var x = "1"; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = "x"; +if (isNaN(void x) !== true) { + $ERROR('#2: var x = "x"; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#3 +var x = new String("-1"); +if (void x !== undefined) { + $ERROR('#3: var x = new String("-1"); void x === undefined. Actual: ' + (void x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T4.js b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T4.js new file mode 100644 index 000000000..d6da81854 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T4.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. + +/** + * Operator "void" evaluates UnaryExpression and returns undefined + * + * @path ch11/11.4/11.4.2/S11.4.2_A4_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +var x; +if (isNaN(void x) !== true) { + $ERROR('#1: var x; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = null; +if (void x !== undefined) { + $ERROR('#2: var x = null; void x === undefined. Actual: ' + (void x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T5.js b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T5.js new file mode 100644 index 000000000..2be1def15 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T5.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. + +/** + * Operator "void" evaluates UnaryExpression and returns undefined + * + * @path ch11/11.4/11.4.2/S11.4.2_A4_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +var x = {}; +if (isNaN(void x) !== true) { + $ERROR('#1: var x = {}; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = function(){return 1}; +if (isNaN(void x) !== true) { + $ERROR('#2: var x = function(){return 1}; void x === undefined. Actual: ' + (void x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T6.js b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T6.js new file mode 100644 index 000000000..40c184cbe --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.2/S11.4.2_A4_T6.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. + +/** + * Operator "void" evaluates UnaryExpression and returns undefined + * + * @path ch11/11.4/11.4.2/S11.4.2_A4_T6.js + * @description Checking Simple Assignment operator + */ + +//CHECK#1 +var x = 0; +if (void (x = 1) !== undefined) { + $ERROR('#1: var x = 0; void (x = 1) === undefined. Actual: ' + (void (x = 1))); +} else { + if (x !== 1) { + $ERROR('#1: var x = 0; void (x = 1); x === 1. Actual: ' + (x)); + } +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.2/browser.js b/js/src/tests/test262/ch11/11.4/11.4.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.2/browser.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.2/shell.js b/js/src/tests/test262/ch11/11.4/11.4.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.2/shell.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A1.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A1.js new file mode 100644 index 000000000..5021bab91 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A1.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. + +/** + * White Space and Line Terminator between "typeof" and UnaryExpression are allowed + * + * @path ch11/11.4/11.4.3/S11.4.3_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("var x = 0; typeof\u0009x") !== "number") { + $ERROR('#1: var x = 0; typeof\\u0009x; x === "number". Actual: ' + (x)); +} + +//CHECK#2 +if (eval("var x = 0; typeof\u000Bx") !== "number") { + $ERROR('#2: var x = 0; typeof\\u000Bx; x === "number". Actual: ' + (x)); +} + +//CHECK#3 +if (eval("var x = 0; typeof\u000Cx") !== "number") { + $ERROR('#3: var x = 0; typeof\\u000Cx; x === "number". Actual: ' + (x)); +} + +//CHECK#4 +if (eval("var x = 0; typeof\u0020x") !== "number") { + $ERROR('#4: var x = 0; typeof\\u0020x; x === "number". Actual: ' + (x)); +} + +//CHECK#5 +if (eval("var x = 0; typeof\u00A0x") !== "number") { + $ERROR('#5: var x = 0; typeof\\u00A0x; x === "number". Actual: ' + (x)); +} + +//CHECK#6 +if (eval("var x = 0; typeof\u000Ax") !== "number") { + $ERROR('#6: var x = 0; typeof\\u000Ax; x === "number". Actual: ' + (x)); +} + +//CHECK#7 +if (eval("var x = 0; typeof\u000Dx") !== "number") { + $ERROR('#7: var x = 0; typeof\\u000Dx; x === "number". Actual: ' + (x)); +} + +//CHECK#8 +if (eval("var x = 0; typeof\u2028x") !== "number") { + $ERROR('#8: var x = 0; typeof\\u2028x; x === "number". Actual: ' + (x)); +} + +//CHECK#9 +if (eval("var x = 0; typeof\u2029x") !== "number") { + $ERROR('#9: var x = 0; typeof\\u2029x; x === "number". Actual: ' + (x)); +} + +//CHECK#10 +if (eval("var x = 0; typeof\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x") !== "number") { + $ERROR('#10: var x = 0; typeof\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === "number". Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A2_T1.js new file mode 100644 index 000000000..02217c333 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A2_T1.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. + +/** + * Operator "typeof" uses GetValue + * + * @path ch11/11.4/11.4.3/S11.4.3_A2_T1.js + * @description Either Type(x) is not Reference or GetBase(x) is not null + */ + +//CHECK#1 +if (typeof 0 !== "number") { + $ERROR('#1: typeof 0 === "number". Actual: ' + (typeof 0)); +} + +//CHECK#2 +var x = 0; +if (typeof x !== "number") { + $ERROR('#2: typeof x === "number". Actual: ' + (typeof x)); +} + +//CHECK#3 +var x = new Object(); +if (typeof x !== "object") { + $ERROR('#3: var x = new Object(); typeof x === "object". Actual: ' + (typeof x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A2_T2.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A2_T2.js new file mode 100644 index 000000000..4030c1257 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A2_T2.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. + +/** + * Operator "typeof" uses GetValue + * + * @path ch11/11.4/11.4.3/S11.4.3_A2_T2.js + * @description If GetBase(x) is null, return "undefined" + */ + +//CHECK#1 +if (typeof x !== "undefined") { + $ERROR('#1: typeof x === "undefined". Actual: ' + (typeof x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.1.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.1.js new file mode 100644 index 000000000..1609ad326 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.1.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. + +/** + * Result of applying "typeof" operator to undefined is "undefined" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.1.js + * @description typeof undefined === "undefined" + */ + +//CHECK#1 +if (typeof undefined !== "undefined") { + $ERROR('#1: typeof undefined === "undefined". Actual: ' + (typeof undefined)); +} + +//CHECK#2 +if (typeof void 0 !== "undefined") { + $ERROR('#2: typeof void 0 === "undefined". Actual: ' + (typeof void 0)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.2.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.2.js new file mode 100644 index 000000000..94353f557 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.2.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. + +/** + * Result of applying "typeof" operator to null is "object" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.2.js + * @description typeof null === "object" + */ + +//CHECK#1 +if (typeof null !== "object") { + $ERROR('#1: typeof null === "object". Actual: ' + (typeof null)); +} + +//CHECK#2 +if (typeof RegExp("0").exec("1") !== "object") { + $ERROR('#2: typeof RegExp("0").exec("1") === "object". Actual: ' + (typeof RegExp("0").exec("1"))); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.3.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.3.js new file mode 100644 index 000000000..70dcf3ec6 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.3.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. + +/** + * Result of applying "typeof" operator to boolean is "boolean" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.3.js + * @description typeof (boolean value) === "boolean" + */ + +//CHECK#1 +if (typeof true !== "boolean") { + $ERROR('#1: typeof true === "boolean". Actual: ' + (typeof true)); +} + +//CHECK#2 +if (typeof false !== "boolean") { + $ERROR('#2: typeof false === "boolean". Actual: ' + (typeof false)); +} + +//CHECK#3 +if (typeof !-1 !== "boolean") { + $ERROR('#3: typeof !-1 === "boolean". Actual: ' + (typeof !-1)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.4.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.4.js new file mode 100644 index 000000000..e1444e9f5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.4.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. + +/** + * Result of appying "typeof" operator to number is "number" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.4.js + * @description typeof (number value) === "number" + */ + +//CHECK#1 +if (typeof 1 !== "number") { + $ERROR('#1: typeof 1 === "number". Actual: ' + (typeof 1)); +} + +//CHECK#2 +if (typeof Number.NaN !== "number") { + $ERROR('#2: typeof NaN === "number". Actual: ' + (typeof NaN)); +} + +//CHECK#3 +if (typeof Number.POSITIVE_INFINITY !== "number") { + $ERROR('#3: typeof Infinity === "number". Actual: ' + (typeof Infinity)); +} + +//CHECK#4 +if (typeof Number.NEGATIVE_INFINITY !== "number") { + $ERROR('#4: typeof -Infinity === "number". Actual: ' + (typeof -Infinity)); +} + +//CHECK#5 +if (typeof Math.PI !== "number") { + $ERROR('#5: typeof Math.PI === "number". Actual: ' + (typeof Math.PI)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.5.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.5.js new file mode 100644 index 000000000..f1c07acd1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.5.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. + +/** + * Result of appying "typeof" operator to string is "string" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.5.js + * @description typeof (string value) === "string" + */ + +//CHECK#1 +if (typeof "1" !== "string") { + $ERROR('#1: typeof "1" === "string". Actual: ' + (typeof "1")); +} + +//CHECK#2 +if (typeof "NaN" !== "string") { + $ERROR('#2: typeof "NaN" === "string". Actual: ' + (typeof "NaN")); +} + +//CHECK#3 +if (typeof "Infinity" !== "string") { + $ERROR('#3: typeof "Infinity" === "string". Actual: ' + (typeof "Infinity")); +} + +//CHECK#4 +if (typeof "" !== "string") { + $ERROR('#4: typeof "" === "string". Actual: ' + (typeof "")); +} + +//CHECK#5 +if (typeof "true" !== "string") { + $ERROR('#5: typeof "true" === "string". Actual: ' + (typeof "true")); +} + +//CHECK#6 +if (typeof Date() !== "string") { + $ERROR('#6: typeof Date() === "string". Actual: ' + (typeof Date())); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.6.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.6.js new file mode 100644 index 000000000..feab82ac6 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.6.js @@ -0,0 +1,73 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of applying "typeof" operator to the object that is native and doesn't implement [[Call]] is "object" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.6.js + * @description typeof (object without [[Call]]) === "object" + */ + +//CHECK#1 +if (typeof this !== "object") { + $ERROR('#1: typeof this === "object". Actual: ' + (typeof this)); +} + +//CHECK#2 +if (typeof new Object() !== "object") { + $ERROR('#2: typeof new Object() === "object". Actual: ' + (typeof new Object())); +} + +//CHECK#3 +if (typeof new Array(1,2,3) !== "object") { + $ERROR('#3: typeof new Array(1,2,3) === "object". Actual: ' + (typeof new Array(1,2,3))); +} + +//CHECK#4 +if (typeof Array(1,2,3) !== "object") { + $ERROR('#4: typeof Array(1,2,3) === "object". Actual: ' + (typeof Array(1,2,3))); +} + +//CHECK#5 +if (typeof new String("x") !== "object") { + $ERROR('#5: typeof new String("x") === "object". Actual: ' + (typeof new String("x"))); +} + +//CHECK#6 +if (typeof new Boolean(true) !== "object") { + $ERROR('#6: typeof new Boolean(true) === "object". Actual: ' + (typeof new Boolean(true))); +} + +//CHECK#7 +if (typeof new Number(1) !== "object") { + $ERROR('#7: typeof new Number(1) === "object". Actual: ' + (typeof new Number(1))); +} + +//CHECK#8 +//The Math object does not have a [[Construct]] property; +//it is not possible to use the Math object as a constructor with the new operator. +//The Math object does not have a [[Call]] property; it is not possible to invoke the Math object as a object. +if (typeof Math !== "object") { + $ERROR('#8: typeof Math === "object". Actual: ' + (typeof Math)); +} + +//CHECK#9 +if (typeof new Date() !== "object") { + $ERROR('#9: typeof new Date() === "object". Actual: ' + (typeof new Date())); +} + +//CHECK#10 +if (typeof new Error() !== "object") { + $ERROR('#10: typeof new Error() === "object". Actual: ' + (typeof new Error())); +} + +//CHECK#11 +if (typeof new RegExp() !== "object") { + $ERROR('#11: typeof new RegExp() === "object". Actual: ' + (typeof new RegExp())); +} + +//CHECK#12 +if (typeof RegExp() !== "object") { + $ERROR('#12: typeof RegExp() === "object". Actual: ' + (typeof RegExp())); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.7.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.7.js new file mode 100644 index 000000000..66282799a --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.7.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of applying "typeof" operator to the object that is native and implements [[Call]] is "function" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.7.js + * @description typeof (object with [[Call]]) === "function" + */ + +//CHECK#1 +if (typeof new Function() !== "function") { + $ERROR('#1: typeof new Function() === "function". Actual: ' + (typeof new Function())); +} + +//CHECK#2 +if (typeof Function() !== "function") { + $ERROR('#2: typeof Function() === "function". Actual: ' + (typeof Function())); +} + +//CHECK#3 +if (typeof Object !== "function") { + $ERROR('#3: typeof Object === "function". Actual: ' + (typeof Object)); +} + +//CHECK#4 +if (typeof String !== "function") { + $ERROR('#4: typeof String === "function". Actual: ' + (typeof String)); +} + +//CHECK5 +if (typeof Boolean !== "function") { + $ERROR('#5: typeof Boolean === "function". Actual: ' + (typeof Boolean)); +} + +//CHECK#6 +if (typeof Number !== "function") { + $ERROR('#6: typeof Number === "function". Actual: ' + (typeof Number)); +} + +//CHECK#7 +if (typeof Date !== "function") { + $ERROR('#7: typeof Date === "function". Actual: ' + (typeof Date)); +} + +//CHECK#8 +if (typeof Error !== "function") { + $ERROR('#8: typeof Error === "function". Actual: ' + (typeof Error)); +} + +//CHECK#9 +if (typeof RegExp !== "function") { + $ERROR('#9: typeof RegExp === "function". Actual: ' + (typeof RegExp)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/browser.js b/js/src/tests/test262/ch11/11.4/11.4.3/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/browser.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/shell.js b/js/src/tests/test262/ch11/11.4/11.4.3/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/shell.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-1-s.js b/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-1-s.js new file mode 100644 index 000000000..f7e9b82de --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-1-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.4/11.4.4-2-1-s.js
+ * @description Strict Mode - SyntaxError is thrown for ++eval
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var blah = eval;
+ try {
+ eval("++eval;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError && blah === eval;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-2-s.js b/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-2-s.js new file mode 100644 index 000000000..142adabef --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-2-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.4/11.4.4-2-2-s.js
+ * @description Strict Mode - SyntaxError is thrown for ++arguments
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var blah = arguments;
+ try {
+ eval("++arguments;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError && blah === arguments;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-3-s.js b/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-3-s.js new file mode 100644 index 000000000..00d6448e3 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-3-s.js @@ -0,0 +1,19 @@ +/// 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.4/11.4.4/11.4.4-2-3-s.js
+ * @description Strict Mode - SyntaxError is not thrown for ++arguments[...]
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ arguments[1] = 7;
+ ++arguments[1];
+ return arguments[1]===8;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A1.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A1.js new file mode 100644 index 000000000..1a6f53940 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A1.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. + +/** + * White Space and Line Terminator between "++" and UnaryExpression are allowed + * + * @path ch11/11.4/11.4.4/S11.4.4_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("var x = 0; ++\u0009x") !== 1) { + $ERROR('#1: var x = 0; ++\\u0009x; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +if (eval("var x = 0; ++\u000Bx") !== 1) { + $ERROR('#2: var x = 0; ++\\u000Bx; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +if (eval("var x = 0; ++\u000Cx") !== 1) { + $ERROR('#3: var x = 0; ++\\u000Cx; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +if (eval("var x = 0; ++\u0020x") !== 1) { + $ERROR('#4: var x = 0; ++\\u0020x; x === 1. Actual: ' + (x)); +} + +//CHECK#5 +if (eval("var x = 0; ++\u00A0x") !== 1) { + $ERROR('#5: var x = 0; ++\\u00A0x; x === 1. Actual: ' + (x)); +} + +//CHECK#6 +if (eval("var x = 0; ++\u000Ax") !== 1) { + $ERROR('#6: var x = 0; ++\\u000Ax; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +if (eval("var x = 0; ++\u000Dx") !== 1) { + $ERROR('#7: var x = 0; ++\\u000Dx; x === 1. Actual: ' + (x)); +} + +//CHECK#8 +if (eval("var x = 0; ++\u2028x") !== 1) { + $ERROR('#8: var x = 0; ++\\u2028x; x === 1. Actual: ' + (x)); +} + +//CHECK#9 +if (eval("var x = 0; ++\u2029x") !== 1) { + $ERROR('#9: var x = 0; ++\\u2029x; x === 1. Actual: ' + (x)); +} + +//CHECK#10 +if (eval("var x = 0; ++\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x") !== 1) { + $ERROR('#10: var x = 0; ++\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T1.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T1.js new file mode 100644 index 000000000..253e2a970 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T1.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. + +/** + * Operator ++x uses GetValue and PutValue + * + * @path ch11/11.4/11.4.4/S11.4.4_A2.1_T1.js + * @description Type(x) is Reference and GetBase(x) is not null + */ + +//CHECK#1 +var x = 1; +if (++x !== 1 + 1) { + $ERROR('#1: var x = 1; ++x === 1 + 1. Actual: ' + (++x)); +} else { + if (x !== 1 + 1) { + $ERROR('#1: var x = 1; ++x; x === 1 + 1. Actual: ' + (x)); + } +} + +//CHECK#2 +this.x = 1; +if (++this.x !== 1 + 1) { + $ERROR('#2: this.x = 1; ++this.x === 1 + 1. Actual: ' + (++this.x)); +} else { + if (this.x !== 1 + 1) { + $ERROR('#2: this.x = 1; ++this.x; this.x === 1 + 1. Actual: ' + (this.x)); + } +} + +//CHECK#3 +var object = new Object(); +object.prop = 1; +if (++object.prop !== 1 + 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; ++object.prop === 1 + 1. Actual: ' + (++object.prop)); +} else { + if (this.x !== 1 + 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; ++object.prop; object.prop === 1 + 1. Actual: ' + (object.prop)); + } +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T2.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T2.js new file mode 100644 index 000000000..a67137e4b --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T2.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. + +/** + * Operator ++x uses GetValue and PutValue + * + * @path ch11/11.4/11.4.4/S11.4.4_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + ++x; + $ERROR('#1.1: ++x throw ReferenceError. Actual: ' + (++x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: ++x throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T3.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T3.js new file mode 100644 index 000000000..7faa4d81f --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T3.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. + +/** + * Operator ++x uses GetValue and PutValue + * + * @path ch11/11.4/11.4.4/S11.4.4_A2.1_T3.js + * @description If Type(x) is not Reference, throw ReferenceError (or SyntaxError) + * @negative + */ + +//CHECK#1 +try { + ++1; + $ERROR('#1.1: ++1 throw ReferenceError (or SyntaxError). Actual: ' + (++1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: ++1 throw ReferenceError (or SyntaxError). Actual: ' + (e)); + } else { + ++1; + } +} + + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.2_T1.js new file mode 100644 index 000000000..bdc909df1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.2_T1.js @@ -0,0 +1,104 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator ++x uses [[Default Value]] + * + * @path ch11/11.4/11.4.4/S11.4.4_A2.2_T1.js + * @description If Type(value) is Object, evaluate ToPrimitive(value, Number) + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (++object !== 1 + 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (++object !== 1 + 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (++object !== 1 + 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (++object !== 1 + 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ++object === 1 + 1. Actual: ' + (++object)); + } else { + if (object !== 1 + 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ++object; object === 1 + 1. Actual: ' + (object)); + } + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ++object not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ++object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (++object !== 1 + 1) { + $ERROR('#5.1: var object = {toString: function() {return 1}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + $ERROR('#5.2: var object = {toString: function() {return 1}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (++object !== 1 + 1) { + $ERROR('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + $ERROR('#6.2: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + ++object; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ++object throw "error". Actual: ' + (++object)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ++object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + ++object; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ++object throw TypeError. Actual: ' + (++object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ++object throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T1.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T1.js new file mode 100644 index 000000000..9c41505c9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_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. + +/** + * Operator ++x returns x = ToNumber(x) + 1 + * + * @path ch11/11.4/11.4.4/S11.4.4_A3_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +var x = false; +++x; +if (x !== 0 + 1) { + $ERROR('#1: var x = false; ++x; x === 0 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Boolean(true); +++x; +if (x !== 1 + 1) { + $ERROR('#2: var x = new Boolean(true); ++x; x === 1 + 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T2.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T2.js new file mode 100644 index 000000000..52296a948 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T2.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. + +/** + * Operator ++x returns x = ToNumber(x) + 1 + * + * @path ch11/11.4/11.4.4/S11.4.4_A3_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +var x = 0.1; +++x; +if (x !== 0.1 + 1) { + $ERROR('#1: var x = 0.1; ++x; x === 0.1 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Number(-1.1); +++x; +if (x !== -1.1 + 1) { + $ERROR('#2: var x = new Number(-1.1); ++x; x === -1.1 + 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T3.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T3.js new file mode 100644 index 000000000..aee3607dd --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T3.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. + +/** + * Operator ++x returns x = ToNumber(x) + 1 + * + * @path ch11/11.4/11.4.4/S11.4.4_A3_T3.js + * @description Type(x) is string primitive or String object + */ + +//CHECK#1 +var x = "1"; +++x; +if (x !== 1 + 1) { + $ERROR('#1: var x = "1"; ++x; x === 1 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = "x"; +++x; +if (isNaN(x) !== true) { + $ERROR('#2: var x = "x"; ++x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +var x = new Number("-1"); +++x; +if (x !== -1 + 1) { + $ERROR('#3: var x = new String("-1"); ++x; x === -1 + 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T4.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T4.js new file mode 100644 index 000000000..89619003e --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T4.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. + +/** + * Operator ++x returns x = ToNumber(x) + 1 + * + * @path ch11/11.4/11.4.4/S11.4.4_A3_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +var x; +++x; +if (isNaN(x) !== true) { + $ERROR('#1: var x; ++x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +++x; +if (x !== 1) { + $ERROR('#2: var x = null; ++x; x === 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T5.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T5.js new file mode 100644 index 000000000..d08522f72 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T5.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. + +/** + * Operator ++x returns x = ToNumber(x) + 1 + * + * @path ch11/11.4/11.4.4/S11.4.4_A3_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +var x = {}; +++x; +if (isNaN(x) !== true) { + $ERROR('#1: var x = {}; ++x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = function(){return 1}; +++x; +if (isNaN(x) !== true) { + $ERROR('#2: var x = function(){return 1}; ++x; x === Not-a-Number. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T1.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T1.js new file mode 100644 index 000000000..585e75091 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_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. + +/** + * Operator ++x returns ToNumber(x) + 1 + * + * @path ch11/11.4/11.4.4/S11.4.4_A4_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +var x = false; +if (++x !== 0 + 1) { + $ERROR('#1: var x = false; ++x === 0 + 1. Actual: ' + (++x)); +} + +//CHECK#2 +var x = new Boolean(true); +if (++x !== 1 + 1) { + $ERROR('#2: var x = new Boolean(true); ++x === 1 + 1. Actual: ' + (++x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T2.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T2.js new file mode 100644 index 000000000..3aacac1b8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_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. + +/** + * Operator ++x returns ToNumber(x) + 1 + * + * @path ch11/11.4/11.4.4/S11.4.4_A4_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +var x = 0.1; +if (++x !== 0.1 + 1) { + $ERROR('#1: var x = 0.1; ++x === 0.1 + 1. Actual: ' + (++x)); +} + +//CHECK#2 +var x = new Number(-1.1); +if (++x !== -1.1 + 1) { + $ERROR('#2: var x = new Number(-1.1); ++x === -1.1 + 1. Actual: ' + (++x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T3.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T3.js new file mode 100644 index 000000000..4e2d5f22a --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_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. + +/** + * Operator ++x returns ToNumber(x) + 1 + * + * @path ch11/11.4/11.4.4/S11.4.4_A4_T3.js + * @description Type(x) is string primitive or String object + */ + +//CHECK#1 +var x = "1"; +if (++x !== 1 + 1) { + $ERROR('#1: var x = "1"; ++x === 1 + 1. Actual: ' + (++x)); +} + +//CHECK#2 +var x = "x"; +if (isNaN(++x) !== true) { + $ERROR('#2: var x = "x"; ++x === Not-a-Number. Actual: ' + (++x)); +} + +//CHECK#3 +var x = new String("-1"); +if (++x !== -1 + 1) { + $ERROR('#3: var x = new String("-1"); ++x === -1 + 1. Actual: ' + (++x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T4.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T4.js new file mode 100644 index 000000000..f0edb536e --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T4.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. + +/** + * Operator ++x returns ToNumber(x) + 1 + * + * @path ch11/11.4/11.4.4/S11.4.4_A4_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +var x; +if (isNaN(++x) !== true) { + $ERROR('#1: var x; ++x === Not-a-Number. Actual: ' + (++x)); +} + +//CHECK#2 +var x = null; +if (++x !== 1) { + $ERROR('#2: var x = null; ++x === 1. Actual: ' + (++x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T5.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T5.js new file mode 100644 index 000000000..c6c9d526a --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T5.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. + +/** + * Operator ++x returns ToNumber(x) + 1 + * + * @path ch11/11.4/11.4.4/S11.4.4_A4_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +var x = {}; +if (isNaN(++x) !== true) { + $ERROR('#1: var x = {}; ++x === Not-a-Number. Actual: ' + (++x)); +} + +//CHECK#2 +var x = function(){return 1}; +if (isNaN(++x) !== true) { + $ERROR('#2: var x = function(){return 1}; ++x === Not-a-Number. Actual: ' + (++x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/browser.js b/js/src/tests/test262/ch11/11.4/11.4.4/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/browser.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/shell.js b/js/src/tests/test262/ch11/11.4/11.4.4/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/shell.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-1-s.js b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-1-s.js new file mode 100644 index 000000000..2c0d4c1a1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-1-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.5/11.4.5-2-1-s.js
+ * @description Strict Mode - SyntaxError is thrown for --eval
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var blah = eval;
+ try {
+ eval("--eval;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError && blah === eval;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-2-s.js b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-2-s.js new file mode 100644 index 000000000..373dabe9e --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-2-s.js @@ -0,0 +1,23 @@ +/// 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.4/11.4.5/11.4.5-2-2-s.js
+ * @description Strict Mode - SyntaxError is thrown for --arguments
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var blah = arguments;
+ try {
+ eval("--arguments;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError && blah === arguments;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-2gs.js b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-2gs.js new file mode 100644 index 000000000..3040d8029 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-2gs.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.4/11.4.5/11.4.5-2-2gs.js
+ * @description Strict Mode - SyntaxError is throw if the UnaryExpression operated upon by a Prefix Increment operator(--arguments)
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+
+"use strict";
+throw NotEarlyError;
+--arguments;
diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-3-s.js b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-3-s.js new file mode 100644 index 000000000..9af3f7bcb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-3-s.js @@ -0,0 +1,19 @@ +/// 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.4/11.4.5/11.4.5-2-3-s.js
+ * @description Strict Mode - SyntaxError is not thrown for --arguments[...]
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ arguments[1] = 7;
+ --arguments[1];
+ return arguments[1]===6;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A1.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A1.js new file mode 100644 index 000000000..5be2493ee --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A1.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. + +/** + * White Space and Line Terminator between "--" and UnaryExpression are allowed + * + * @path ch11/11.4/11.4.5/S11.4.5_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("var x = 1; --\u0009x") !== 0) { + $ERROR('#1: var x = 1; --\\u0009x; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +if (eval("var x = 1; --\u000Bx") !== 0) { + $ERROR('#2: var x = 1; --\\u000Bx; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +if (eval("var x = 1; --\u000Cx") !== 0) { + $ERROR('#3: var x = 1; --\\u000Cx; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +if (eval("var x = 1; --\u0020x") !== 0) { + $ERROR('#4: var x = 1; --\\u0020x; x === 0. Actual: ' + (x)); +} + +//CHECK#5 +if (eval("var x = 1; --\u00A0x") !== 0) { + $ERROR('#5: var x = 1; --\\u00A0x; x === 0. Actual: ' + (x)); +} + +//CHECK#6 +if (eval("var x = 1; --\u000Ax") !== 0) { + $ERROR('#6: var x = 1; --\\u000Ax; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +if (eval("var x = 1; --\u000Dx") !== 0) { + $ERROR('#7: var x = 1; --\\u000Dx; x === 0. Actual: ' + (x)); +} + +//CHECK#8 +if (eval("var x = 1; --\u2028x") !== 0) { + $ERROR('#8: var x = 1; --\\u2028x; x === 0. Actual: ' + (x)); +} + +//CHECK#9 +if (eval("var x = 1; --\u2029x") !== 0) { + $ERROR('#9: var x = 1; --\\u2029x; x === 0. Actual: ' + (x)); +} + +//CHECK#10 +if (eval("var x = 1; --\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x") !== 0) { + $ERROR('#10: var x = 1; --\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === 0. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T1.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T1.js new file mode 100644 index 000000000..136b72c51 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T1.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. + +/** + * Operator --x uses GetValue and PutValue + * + * @path ch11/11.4/11.4.5/S11.4.5_A2.1_T1.js + * @description Type(x) is Reference and GetBase(x) is not null + */ + +//CHECK#1 +var x = 1; +if (--x !== 1 - 1) { + $ERROR('#1: var x = 1; --x === 1 - 1. Actual: ' + (--x)); +} else { + if (x !== 1 - 1) { + $ERROR('#1: var x = 1; --x; x === 1 - 1. Actual: ' + (x)); + } +} + +//CHECK#2 +this.x = 1; +if (--this.x !== 1 - 1) { + $ERROR('#2: this.x = 1; --this.x === 1 - 1. Actual: ' + (--this.x)); +} else { + if (this.x !== 1 - 1) { + $ERROR('#2: this.x = 1; --this.x; this.x === 1 - 1. Actual: ' + (this.x)); + } +} + +//CHECK#3 +var object = new Object(); +object.prop = 1; +if (--object.prop !== 1 - 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; --object.prop === 1 - 1. Actual: ' + (--object.prop)); +} else { + if (this.x !== 1 - 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; --object.prop; object.prop === 1 - 1. Actual: ' + (object.prop)); + } +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T2.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T2.js new file mode 100644 index 000000000..2dabef975 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_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. + +/** + * Operator --x uses GetValue and PutValue + * + * @path ch11/11.4/11.4.5/S11.4.5_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + --x; + $ERROR('#1.1: --x throw ReferenceError. Actual: ' + (--x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: --x throw ReferenceError. Actual: ' + (e)); + } +} + + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T3.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T3.js new file mode 100644 index 000000000..5700185b9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T3.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. + +/** + * Operator --x uses GetValue and PutValue + * + * @path ch11/11.4/11.4.5/S11.4.5_A2.1_T3.js + * @description If Type(x) is not Reference, throw ReferenceError (or SyntaxError) + * @negative + */ + +//CHECK#1 +try { + --1; + $ERROR('#1.1: --1 throw ReferenceError (or SyntaxError). Actual: ' + (--1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: --1 throw ReferenceError (or SyntaxError). Actual: ' + (e)); + } else { + --1; + } +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.2_T1.js new file mode 100644 index 000000000..6f19db9db --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.2_T1.js @@ -0,0 +1,104 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator --x uses [[Default Value]] + * + * @path ch11/11.4/11.4.5/S11.4.5_A2.2_T1.js + * @description If Type(value) is Object, evaluate ToPrimitive(value, Number) + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (--object !== 1 - 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (--object !== 1 - 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (--object !== 1 - 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (--object !== 1 - 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object === 1 - 1. Actual: ' + (--object)); + } else { + if (object !== 1 - 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object; object === 1 - 1. Actual: ' + (object)); + } + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (--object !== 1 - 1) { + $ERROR('#5.1: var object = {toString: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + $ERROR('#5.2: var object = {toString: function() {return 1}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (--object !== 1 - 1) { + $ERROR('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + $ERROR('#6.2: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + --object; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; --object throw "error". Actual: ' + (--object)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; --object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + --object; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; --object throw TypeError. Actual: ' + (--object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; --object throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T1.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T1.js new file mode 100644 index 000000000..f7fd9fc7b --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_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. + +/** + * Operator --x returns x = ToNumber(x) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A3_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +var x = true; +--x; +if (x !== 1 - 1) { + $ERROR('#1: var x = true; --x; x === 1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Boolean(false); +--x; +if (x !== 0 - 1) { + $ERROR('#2: var x = new Boolean(false); --x; x === 0 - 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T2.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T2.js new file mode 100644 index 000000000..a946e8648 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T2.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. + +/** + * Operator --x returns x = ToNumber(x) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A3_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +var x = 0.1; +--x; +if (x !== 0.1 - 1) { + $ERROR('#1: var x = 0.1; --x; x === 0.1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Number(-1.1); +--x; +if (x !== -1.1 - 1) { + $ERROR('#2: var x = new Number(-1.1); --x; x === -1.1 - 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T3.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T3.js new file mode 100644 index 000000000..6ed487073 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T3.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. + +/** + * Operator --x returns x = ToNumber(x) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A3_T3.js + * @description Type(x) is primitive string or String object + */ + +//CHECK#1 +var x = "1"; +--x; +if (x !== 1 - 1) { + $ERROR('#1: var x = "1"; --x; x === 1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = "x"; +--x; +if (isNaN(x) !== true) { + $ERROR('#2: var x = "x"; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +var x = new Number("-1"); +--x; +if (x !== -1 - 1) { + $ERROR('#3: var x = new String("-1"); --x; x === -1 - 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T4.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T4.js new file mode 100644 index 000000000..ed0d7798b --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T4.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. + +/** + * Operator --x returns x = ToNumber(x) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A3_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +var x; +--x; +if (isNaN(x) !== true) { + $ERROR('#1: var x; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +--x; +if (x !== -1) { + $ERROR('#2: var x = null; --x; x === -1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T5.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T5.js new file mode 100644 index 000000000..0fd3f76ac --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T5.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. + +/** + * Operator --x returns x = ToNumber(x) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A3_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +var x = {}; +--x; +if (isNaN(x) !== true) { + $ERROR('#1: var x = {}; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = function(){return 1}; +--x; +if (isNaN(x) !== true) { + $ERROR('#2: var x = function(){return 1}; --x; x === Not-a-Number. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T1.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T1.js new file mode 100644 index 000000000..7f424a239 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_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. + +/** + * Operator --x returns ToNumber(x) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A4_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +var x = true; +if (--x !== 1 - 1) { + $ERROR('#1: var x = true; --x === 1 - 1. Actual: ' + (--x)); +} + +//CHECK#2 +var x = new Boolean(false); +if (--x !== 0 - 1) { + $ERROR('#2: var x = new Boolean(false); --x === 0 - 1. Actual: ' + (--x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T2.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T2.js new file mode 100644 index 000000000..c5c77de06 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_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. + +/** + * Operator --x returns ToNumber(x) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A4_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +var x = 0.1; +if (--x !== 0.1 - 1) { + $ERROR('#1: var x = 0.1; --x === 0.1 - 1. Actual: ' + (--x)); +} + +//CHECK#2 +var x = new Number(-1.1); +if (--x !== -1.1 - 1) { + $ERROR('#2: var x = new Number(-1.1); --x === -1.1- 1. Actual: ' + (--x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T3.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T3.js new file mode 100644 index 000000000..29d4d123f --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_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. + +/** + * Operator --x returns ToNumber(x) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A4_T3.js + * @description Type(x) is string primitive or String object + */ + +//CHECK#1 +var x = "1"; +if (--x !== 1 - 1) { + $ERROR('#1: var x = "1"; --x === 1 - 1. Actual: ' + (--x)); +} + +//CHECK#2 +var x = "x"; +if (isNaN(--x) !== true) { + $ERROR('#2: var x = "x"; --x === Not-a-Number. Actual: ' + (--x)); +} + +//CHECK#3 +var x = new String("-1"); +if (--x !== -1 - 1) { + $ERROR('#3: var x = new String("-1"); --x === -1 - 1. Actual: ' + (--x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T4.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T4.js new file mode 100644 index 000000000..a1f600ace --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T4.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. + +/** + * Operator --x returns ToNumber(x) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A4_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +var x; +if (isNaN(--x) !== true) { + $ERROR('#1: var x; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +if (--x !== -1) { + $ERROR('#2: var x = null; --x === -1. Actual: ' + (--x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T5.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T5.js new file mode 100644 index 000000000..fe40976df --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T5.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. + +/** + * Operator --x returns ToNumber(x) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A4_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +var x = {}; +if (isNaN(--x) !== true) { + $ERROR('#1: var x = {}; --x === Not-a-Number. Actual: ' + (--x)); +} + +//CHECK#2 +var x = function(){return 1}; +if (isNaN(--x) !== true) { + $ERROR('#2: var x = function(){return 1}; --x === Not-a-Number. Actual: ' + (--x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/browser.js b/js/src/tests/test262/ch11/11.4/11.4.5/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/browser.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/shell.js b/js/src/tests/test262/ch11/11.4/11.4.5/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/shell.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.6/11.4.6-2-1.js b/js/src/tests/test262/ch11/11.4/11.4.6/11.4.6-2-1.js new file mode 100644 index 000000000..b4d785c18 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.6/11.4.6-2-1.js @@ -0,0 +1,15 @@ +/// 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.4/11.4.6/11.4.6-2-1.js
+ * @description +"" should be zero
+ */
+
+
+function testcase() {
+ return +"" === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A1.js b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A1.js new file mode 100644 index 000000000..ac0f45a12 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A1.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. + +/** + * White Space and Line Terminator between "+" and UnaryExpression are allowed + * + * @path ch11/11.4/11.4.6/S11.4.6_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("+\u00091") !== 1) { + $ERROR('#1: +\\u00091 === 1'); +} + +//CHECK#2 +if (eval("+\u000B1") !== 1) { + $ERROR('#2: +\\u000B1 === 1'); +} + +//CHECK#3 +if (eval("+\u000C1") !== 1) { + $ERROR('#3: +\\u000C1 === 1'); +} + +//CHECK#4 +if (eval("+\u00201") !== 1) { + $ERROR('#4: +\\u0020 === 1'); +} + +//CHECK#5 +if (eval("+\u00A01") !== 1) { + $ERROR('#5: +\\u00A01 === 1'); +} + +//CHECK#6 +if (eval("+\u000A1") !== 1) { + $ERROR('#6: +\\u000A1 === 1'); +} + +//CHECK#7 +if (eval("+\u000D1") !== 1) { + $ERROR('#7: +\\u000D1 === 1'); +} + +//CHECK#8 +if (eval("+\u20281") !== 1) { + $ERROR('#8: +\\u20281 === 1'); +} + +//CHECK#9 +if (eval("+\u20291") !== 1) { + $ERROR('#9: +\\u20291 === 1'); +} + +//CHECK#10 +if (eval("+\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 1) { + $ERROR('#10: +\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 1'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A2.1_T1.js b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A2.1_T1.js new file mode 100644 index 000000000..a3074769a --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A2.1_T1.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. + +/** + * Operator +x uses GetValue + * + * @path ch11/11.4/11.4.6/S11.4.6_A2.1_T1.js + * @description Either Type(x) is not Reference or GetBase(x) is not null + */ + +//CHECK#1 +if (+1 !== 1) { + $ERROR('#1: +1 === 1. Actual: ' + (+1)); +} + +//CHECK#2 +if (+(+1) !== 1) { + $ERROR('#2: +(+1) === -1. Actual: ' + (+(+1))); +} + +//CHECK#3 +var x = 1; +if (+x !== 1) { + $ERROR('#3: var x = +1; -x === 1. Actual: ' + (-x)); +} + +//CHECK#4 +var x = 1; +if (+(+x) !== 1) { + $ERROR('#4: var x = 1; +(+x) === 1. Actual: ' + (+(+x))); +} + +//CHECK#5 +var object = new Object(); +object.prop = 1; +if (+object.prop !== 1) { + $ERROR('#5: var object = new Object(); object.prop = 1; +object.prop === 1. Actual: ' + (+object.prop)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A2.1_T2.js b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A2.1_T2.js new file mode 100644 index 000000000..ab6aa9fe4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A2.1_T2.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. + +/** + * Operator +x uses GetValue + * + * @path ch11/11.4/11.4.6/S11.4.6_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + +x; + $ERROR('#1.1: +x throw ReferenceError. Actual: ' + (+x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: +x throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A2.2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A2.2_T1.js new file mode 100644 index 000000000..78eb580bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A2.2_T1.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator +x uses [[Default Value]] + * + * @path ch11/11.4/11.4.6/S11.4.6_A2.2_T1.js + * @description If Type(value) is Object, evaluate ToPrimitive(value, Number) + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (+object !== 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (+object !== 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (+object !== 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (+object !== 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +object === 1. Actual: ' + (+object)); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +object not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (+object !== 1) { + $ERROR('#5: var object = {toString: function() {return 1}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (+object !== 1) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + +object; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; +object throw "error". Actual: ' + (+object)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; +object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + +object; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; +object throw TypeError. Actual: ' + (+object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; +object throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T1.js b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T1.js new file mode 100644 index 000000000..7338942de --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_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. + +/** + * Operator +x returns ToNumber(x) + * + * @path ch11/11.4/11.4.6/S11.4.6_A3_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +if (+false !== 0) { + $ERROR('#1: +false === 0. Actual: ' + (+false)); +} + +//CHECK#2 +if (+new Boolean(true) !== 1) { + $ERROR('#2: +new Boolean(true) === 1. Actual: ' + (+new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T2.js b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T2.js new file mode 100644 index 000000000..86f537c64 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T2.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. + +/** + * Operator +x returns ToNumber(x) + * + * @path ch11/11.4/11.4.6/S11.4.6_A3_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +if (+0.1 !== 0.1) { + $ERROR('#1: +0.1 === 0.1. Actual: ' + (+0.1)); +} + +//CHECK#2 +if (+new Number(-1.1) !== -1.1) { + $ERROR('#2: +new Number(-1.1) === -1.1. Actual: ' + (+new Number(-1.1))); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T3.js b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T3.js new file mode 100644 index 000000000..36628861a --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T3.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. + +/** + * Operator +x returns ToNumber(x) + * + * @path ch11/11.4/11.4.6/S11.4.6_A3_T3.js + * @description Type(x) is string primitive or String object + */ + +//CHECK#1 +if (+"1" !== 1) { + $ERROR('#1: +"1" === 1. Actual: ' + (+"1")); +} + +//CHECK#2 +if (isNaN(+"x") !== true) { + $ERROR('#2: +"x" === Not-a-Number. Actual: ' + (+"x")); +} + +//CHECK#3 +if (+new Number("-1") !== -1) { + $ERROR('#3: +new String("-1") === -1. Actual: ' + (+new String("-1"))); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T4.js b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T4.js new file mode 100644 index 000000000..61b853375 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_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. + +/** + * Operator +x returns ToNumber(x) + * + * @path ch11/11.4/11.4.6/S11.4.6_A3_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +if (isNaN(+void 0) !== true) { + $ERROR('#1: +void 0 === Not-a-Number. Actual: ' + (+void 0)); +} + +//CHECK#2 +if (+null !== 0) { + $ERROR('#2: +null === 0. Actual: ' + (+null)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T5.js b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T5.js new file mode 100644 index 000000000..9b56ff09f --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.6/S11.4.6_A3_T5.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. + +/** + * Operator +x returns ToNumber(x) + * + * @path ch11/11.4/11.4.6/S11.4.6_A3_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +if (isNaN(+{}) !== true) { + $ERROR('#1: +{} === Not-a-Number. Actual: ' + (+{})); +} + +//CHECK#2 +if (isNaN(+function(){return 1}) !== true) { + $ERROR('#2: +function(){return 1} === Not-a-Number. Actual: ' + (+function(){return 1})); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.6/browser.js b/js/src/tests/test262/ch11/11.4/11.4.6/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.6/browser.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.6/shell.js b/js/src/tests/test262/ch11/11.4/11.4.6/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.6/shell.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/11.4.7-4-1.js b/js/src/tests/test262/ch11/11.4/11.4.7/11.4.7-4-1.js new file mode 100644 index 000000000..12d050866 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/11.4.7-4-1.js @@ -0,0 +1,15 @@ +/// 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.4/11.4.7/11.4.7-4-1.js
+ * @description -"" should be zero
+ */
+
+
+function testcase() {
+ return -"" === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A1.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A1.js new file mode 100644 index 000000000..13234518b --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A1.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. + +/** + * White Space and Line Terminator between "-" and UnaryExpression are allowed + * + * @path ch11/11.4/11.4.7/S11.4.7_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("-\u00091") !== -1) { + $ERROR('#1: -\\u00091 === -1'); +} + +//CHECK#2 +if (eval("-\u000B1") !== -1) { + $ERROR('#2: -\\u000B1 === -1'); +} + +//CHECK#3 +if (eval("-\u000C1") !== -1) { + $ERROR('#3: -\\u000C1 === -1'); +} + +//CHECK#4 +if (eval("-\u00201") !== -1) { + $ERROR('#4: -\\u0020 === -1'); +} + +//CHECK#5 +if (eval("-\u00A01") !== -1) { + $ERROR('#5: -\\u00A01 === -1'); +} + +//CHECK#6 +if (eval("-\u000A1") !== -1) { + $ERROR('#6: -\\u000A1 === -1'); +} + +//CHECK#7 +if (eval("-\u000D1") !== -1) { + $ERROR('#7: -\\u000D1 === -1'); +} + +//CHECK#8 +if (eval("-\u20281") !== -1) { + $ERROR('#8: -\\u20281 === -1'); +} + +//CHECK#9 +if (eval("-\u20291") !== -1) { + $ERROR('#9: -\\u20291 === -1'); +} + +//CHECK#10 +if (eval("-\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== -1) { + $ERROR('#10: -\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === -1'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_T1.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_T1.js new file mode 100644 index 000000000..8b3c47a90 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_T1.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. + +/** + * Operator -x uses GetValue + * + * @path ch11/11.4/11.4.7/S11.4.7_A2.1_T1.js + * @description Either Type(x) is not Reference or GetBase(x) is not null + */ + +//CHECK#1 +if (-1 !== -1) { + $ERROR('#1: -1 === -1. Actual: ' + (-1)); +} + +//CHECK#2 +if (-(-1) !== 1) { + $ERROR('#2: -(-1) === -1. Actual: ' + (-(-1))); +} + +//CHECK#3 +var x = -1; +if (-x !== 1) { + $ERROR('#3: var x = -1; -x === 1. Actual: ' + (-x)); +} + +//CHECK#4 +var x = -1; +if (-(-x) !== -1) { + $ERROR('#4: var x = -1; -(-x) === -1. Actual: ' + (-(-x))); +} + +//CHECK#5 +var object = new Object(); +object.prop = 1; +if (-object.prop !== -1) { + $ERROR('#5: var object = new Object(); object.prop = -1; -object.prop === -1. Actual: ' + (-object.prop)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_T2.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_T2.js new file mode 100644 index 000000000..e7de28aa5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_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. + +/** + * Operator -x uses GetValue + * + * @path ch11/11.4/11.4.7/S11.4.7_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + -x; + $ERROR('#1.1: -x throw ReferenceError. Actual: ' + (-x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: -x throw ReferenceError. Actual: ' + (e)); + } +} + + diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.2_T1.js new file mode 100644 index 000000000..a9ad69e5c --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.2_T1.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator -x uses [[Default Value]] + * + * @path ch11/11.4/11.4.7/S11.4.7_A2.2_T1.js + * @description If Type(value) is Object, evaluate ToPrimitive(value, Number) + */ + +//CHECK#1 +var object = {valueOf: function() {return -1}}; +if (-object !== 1) { + $ERROR('#1: var object = {valueOf: function() {return -1}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#2 +var object = {valueOf: function() {return -1}, toString: function() {return 0}}; +if (-object !== 1) { + $ERROR('#2: var object = {valueOf: function() {return -1}, toString: function() {return 0}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#3 +var object = {valueOf: function() {return -1}, toString: function() {return {}}}; +if (-object !== 1) { + $ERROR('#3: var object = {valueOf: function() {return -1}, toString: function() {return {}}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; + if (-object !== 1) { + $ERROR('#4.1: var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; -object === 1. Actual: ' + (-object)); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; -object not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; -object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return -1}}; +if (-object !== 1) { + $ERROR('#5.1: var object = {toString: function() {return -1}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return -1}} +if (-object !== 1) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return -1}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return -1}}; + -object; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return -1}}; -object throw "error". Actual: ' + (-object)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return -1}}; -object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + -object; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; -object throw TypeError. Actual: ' + (-object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; -object throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T1.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T1.js new file mode 100644 index 000000000..f421d9133 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_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. + +/** + * Operator -x returns -ToNumber(x) + * + * @path ch11/11.4/11.4.7/S11.4.7_A3_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +if (-false !== 0) { + $ERROR('#1: -false === 0. Actual: ' + (-false)); +} + +//CHECK#2 +if (-new Boolean(true) !== -1) { + $ERROR('#2: -new Boolean(true) === -1. Actual: ' + (-new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T2.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T2.js new file mode 100644 index 000000000..611683c12 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T2.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. + +/** + * Operator -x returns -ToNumber(x) + * + * @path ch11/11.4/11.4.7/S11.4.7_A3_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +if (-(1) !== -1) { + $ERROR('#1: -(1) === -1. Actual: ' + (-(1))); +} + +//CHECK#2 +if (-new Number(-1) !== 1) { + $ERROR('#2: -new Number(-1) === 1. Actual: ' + (-new Number(-1))); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T3.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T3.js new file mode 100644 index 000000000..9a439804e --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T3.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. + +/** + * Operator -x returns -ToNumber(x) + * + * @path ch11/11.4/11.4.7/S11.4.7_A3_T3.js + * @description Type(x) is string primitive or String object + */ + +//CHECK#1 +if (-"1" !== -1) { + $ERROR('#1: -"1" === -1. Actual: ' + (-"1")); +} + +//CHECK#2 +if (isNaN(-"x") !== true) { + $ERROR('#2: -"x" === Not-a-Number. Actual: ' + (-"x")); +} + +//CHECK#3 +if (-new String("-1") !== 1) { + $ERROR('#3: -new String("-1") === 1. Actual: ' + (-new String("-1"))); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T4.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T4.js new file mode 100644 index 000000000..7fda40e95 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_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. + +/** + * Operator -x returns -ToNumber(x) + * + * @path ch11/11.4/11.4.7/S11.4.7_A3_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +if (isNaN(-void 0) !== true) { + $ERROR('#1: +void 0 === Not-a-Number. Actual: ' + (+void 0)); +} + +//CHECK#2 +if (-null !== 0) { + $ERROR('#2: +null === 0. Actual: ' + (+null)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T5.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T5.js new file mode 100644 index 000000000..426a4fd8b --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T5.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. + +/** + * Operator -x returns -ToNumber(x) + * + * @path ch11/11.4/11.4.7/S11.4.7_A3_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +if (isNaN(-{}) !== true) { + $ERROR('#1: -{} === Not-a-Number. Actual: ' + (-{})); +} + +//CHECK#2 +if (isNaN(-function(){return 1}) !== true) { + $ERROR('#2: -function(){return 1} === Not-a-Number. Actual: ' + (-function(){return 1})); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.1.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.1.js new file mode 100644 index 000000000..e8d1dfe86 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.1.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 x is NaN, operator -x returns NaN + * + * @path ch11/11.4/11.4.7/S11.4.7_A4.1.js + * @description Checking NaN + */ + +//CHECK#1 +if (isNaN(-NaN) !== true) { + $ERROR('#1: -NaN === Not-a-Number. Actual: ' + (-NaN)); +} + +//CHECK#2 +var x = NaN; +if (isNaN(-x) != true) { + $ERROR('#2: var x = NaN; -x === Not-a-Number. Actual: ' + (-x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.2.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.2.js new file mode 100644 index 000000000..8b39bd249 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.2.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. + +/** + * Negating +0 produces -0, negating -0 produces +0 + * + * @path ch11/11.4/11.4.7/S11.4.7_A4.2.js + * @description Checking Infinity + */ + +//CHECK#1 +var x = 0; +x = -x; +if (x !== -0) { + $ERROR('#1.1: var x = 0; x = -x; x === 0. Actual: ' + (x)); +} else { + if (1/x !== Number.NEGATIVE_INFINITY) { + $ERROR('#1.2: var x = 0; x = -x; x === - 0. Actual: +0'); + } +} + +//CHECK#2 +var x = -0; +x = -x; +if (x !== 0) { + $ERROR('#2.1: var x = -0; x = -x; x === 0. Actual: ' + (x)); +} else { + if (1/x !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: var x = -0; x = -x; x === + 0. Actual: -0'); + } +} + + diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/browser.js b/js/src/tests/test262/ch11/11.4/11.4.7/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/browser.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/shell.js b/js/src/tests/test262/ch11/11.4/11.4.7/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.7/shell.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A1.js b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A1.js new file mode 100644 index 000000000..7a646edfd --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A1.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. + +/** + * White Space and Line Terminator between "~" and UnaryExpression are allowed + * + * @path ch11/11.4/11.4.8/S11.4.8_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("~\u00090") !== -1) { + $ERROR('#0: ~\\u00090 === -1'); +} + +//CHECK#2 +if (eval("~\u000B0") !== -1) { + $ERROR('#2: ~\\u000B0 === -1'); +} + +//CHECK#3 +if (eval("~\u000C0") !== -1) { + $ERROR('#3: ~\\u000C0 === -1'); +} + +//CHECK#4 +if (eval("~\u00200") !== -1) { + $ERROR('#4: ~\\u0020 === -1'); +} + +//CHECK#5 +if (eval("~\u00A00") !== -1) { + $ERROR('#5: ~\\u00A00 === -1'); +} + +//CHECK#6 +if (eval("~\u000A0") !== -1) { + $ERROR('#6: ~\\u000A0 === -1'); +} + +//CHECK#7 +if (eval("~\u000D0") !== -1) { + $ERROR('#7: ~\\u000D0 === -1'); +} + +//CHECK#8 +if (eval("~\u20280") !== -1) { + $ERROR('#8: ~\\u20280 === -1'); +} + +//CHECK#9 +if (eval("~\u20290") !== -1) { + $ERROR('#9: ~\\u20290 === -1'); +} + +//CHECK#10 +if (eval("~\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20290") !== -1) { + $ERROR('#10: ~\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20290 === -1'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A2.1_T1.js b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A2.1_T1.js new file mode 100644 index 000000000..6dc44f7ae --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A2.1_T1.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. + +/** + * Operator ~x uses GetValue + * + * @path ch11/11.4/11.4.8/S11.4.8_A2.1_T1.js + * @description Either Type(x) is not Reference or GetBase(x) is not null + */ + +//CHECK#1 +if (~0 !== -1) { + $ERROR('#1: ~0 === -1. Actual: ' + (~0)); +} + +//CHECK#2 +if (~(~0) !== 0) { + $ERROR('#2: ~(~0) === 0. Actual: ' + (~(~0))); +} + +//CHECK#3 +var x = 0; +if (~x !== -1) { + $ERROR('#3: var x = 0; ~x === -1. Actual: ' + (~x)); +} + +//CHECK#4 +var x = 0; +if (~(~x) !== 0) { + $ERROR('#4: var x = 0; ~(~x) === 0. Actual: ' + (~(~x))); +} + +//CHECK#5 +var object = new Object(); +object.prop = 0; +if (~object.prop !== -1) { + $ERROR('#5: var object = new Object(); object.prop = 0; ~object.prop === -1. Actual: ' + (~object.prop)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A2.1_T2.js b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A2.1_T2.js new file mode 100644 index 000000000..3f53f4673 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A2.1_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. + +/** + * Operator ~x uses GetValue + * + * @path ch11/11.4/11.4.8/S11.4.8_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + ~x; + $ERROR('#1.1: ~x throw ReferenceError. Actual: ' + (~x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: ~x throw ReferenceError. Actual: ' + (e)); + } +} + + diff --git a/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A2.2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A2.2_T1.js new file mode 100644 index 000000000..44b5e6127 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A2.2_T1.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator ~x uses [[Default Value]] + * + * @path ch11/11.4/11.4.8/S11.4.8_A2.2_T1.js + * @description If Type(value) is Object, evaluate ToPrimitive(value, Number) + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (~object !== -2) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (~object !== -2) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (~object !== -2) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (~object !== -2) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object === -2. Actual: ' + (~object)); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (~object !== -2) { + $ERROR('#5: var object = {toString: function() {return 1}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (~object !== -2) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + ~object; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ~object throw "error". Actual: ' + (~object)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ~object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + ~object; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ~object throw TypeError. Actual: ' + (~object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ~object throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T1.js b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T1.js new file mode 100644 index 000000000..0958a0570 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_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. + +/** + * Operator ~x returns ~ToInt32(x) + * + * @path ch11/11.4/11.4.8/S11.4.8_A3_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +if (~false !== -1) { + $ERROR('#1: ~false === -1. Actual: ' + (~false)); +} + +//CHECK#2 +if (~new Boolean(true) !== -2) { + $ERROR('#2: ~new Boolean(true) === -2. Actual: ' + (~new Boolean(true))); +} + +//CHECK#3 +if (~new Boolean(false) !== -1) { + $ERROR('#3: ~new Boolean(false) === -1. Actual: ' + (~new Boolean(false))); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T2.js b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T2.js new file mode 100644 index 000000000..a7b6d4bbc --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T2.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. + +/** + * Operator ~x returns ~ToInt32(x) + * + * @path ch11/11.4/11.4.8/S11.4.8_A3_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +if (~0.1 !== -1) { + $ERROR('#1: ~0.1 === -1. Actual: ' + (~0.1)); +} + +//CHECK#2 +if (~new Number(-0.1) !== -1) { + $ERROR('#2: ~new Number(-0.1) === -1. Actual: ' + (~new Number(-0.1))); +} + +//CHECK#3 +if (~NaN !== -1) { + $ERROR('#3: ~NaN === -1. Actual: ' + (~NaN)); +} + +//CHECK#4 +if (~new Number(NaN) !== -1) { + $ERROR('#4: ~new Number(NaN) === -1. Actual: ' + (~new Number(NaN))); +} + +//CHECK#5 +if (~1 !== -2) { + $ERROR('#5: ~1 === -2. Actual: ' + (~1)); +} + +//CHECK#6 +if (~new Number(-2) !== 1) { + $ERROR('#6: ~new Number(-2) === 1. Actual: ' + (~new Number(-2))); +} + +//CHECK#7 +if (~Infinity !== -1) { + $ERROR('#7: ~Infinity === -1. Actual: ' + (~Infinity)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T3.js b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T3.js new file mode 100644 index 000000000..ec54ebd48 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T3.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. + +/** + * Operator ~x returns ~ToInt32(x) + * + * @path ch11/11.4/11.4.8/S11.4.8_A3_T3.js + * @description Type(x) is string primitive or String object + */ + +//CHECK#1 +if (~"1" !== -2) { + $ERROR('#1: ~"1" === -2. Actual: ' + (~"1")); +} + +//CHECK#2 +if (~new String("0") !== -1) { + $ERROR('#2: ~new String("0") === -1. Actual: ' + (~new String("0"))); +} + +//CHECK#3 +if (~"x" !== -1) { + $ERROR('#3: ~"x" === -1. Actual: ' + (~"x")); +} + +//CHECK#4 +if (~"" !== -1) { + $ERROR('#4: ~"" === -1. Actual: ' + (~"")); +} + +//CHECK#5 +if (~new String("-2") !== 1) { + $ERROR('#5: ~new String("-2") === 1. Actual: ' + (~new String("-2"))); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T4.js b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T4.js new file mode 100644 index 000000000..d8be652d4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_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. + +/** + * Operator ~x returns ~ToInt32(x) + * + * @path ch11/11.4/11.4.8/S11.4.8_A3_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +if (~void 0 !== -1) { + $ERROR('#1: ~void 0 === -1. Actual: ' + (~void 0)); +} + +//CHECK#2 +if (~null !== -1) { + $ERROR('#2: ~null === -1. Actual: ' + (~null)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T5.js b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T5.js new file mode 100644 index 000000000..8fcfc740b --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.8/S11.4.8_A3_T5.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. + +/** + * Operator ~x returns ~ToInt32(x) + * + * @path ch11/11.4/11.4.8/S11.4.8_A3_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +if (~({}) !== -1) { + $ERROR('#1: ~({}) === -1. Actual: ' + (~({}))); +} + +//CHECK#2 +if (~(function(){return 1}) !== -1) { + $ERROR('#2: ~(function(){return 1}) === -1. Actual: ' + (~(function(){return 1}))); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.8/browser.js b/js/src/tests/test262/ch11/11.4/11.4.8/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.8/browser.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.8/shell.js b/js/src/tests/test262/ch11/11.4/11.4.8/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.8/shell.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A1.js b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A1.js new file mode 100644 index 000000000..e4c26d0a1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A1.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. + +/** + * White Space and Line Terminator between "!" and UnaryExpression are allowed + * + * @path ch11/11.4/11.4.9/S11.4.9_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("!\u0009true") !== false) { + $ERROR('#true: !\\u0009true === false'); +} + +//CHECK#2 +if (eval("!\u000Btrue") !== false) { + $ERROR('#2: !\\u000Btrue === false'); +} + +//CHECK#3 +if (eval("!\u000Ctrue") !== false) { + $ERROR('#3: !\\u000Ctrue === false'); +} + +//CHECK#4 +if (eval("!\u0020true") !== false) { + $ERROR('#4: !\\u0020 === false'); +} + +//CHECK#5 +if (eval("!\u00A0true") !== false) { + $ERROR('#5: !\\u00A0true === false'); +} + +//CHECK#6 +if (eval("!\u000Atrue") !== false) { + $ERROR('#6: !\\u000Atrue === false'); +} + +//CHECK#7 +if (eval("!\u000Dtrue") !== false) { + $ERROR('#7: !\\u000Dtrue === false'); +} + +//CHECK#8 +if (eval("!\u2028true") !== false) { + $ERROR('#8: !\\u2028true === false'); +} + +//CHECK#9 +if (eval("!\u2029true") !== false) { + $ERROR('#9: !\\u2029true === false'); +} + +//CHECK#10 +if (eval("!\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true") !== false) { + $ERROR('#10: !\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true === false'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A2.1_T1.js b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A2.1_T1.js new file mode 100644 index 000000000..d08fdd181 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A2.1_T1.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. + +/** + * Operator !x uses GetValue + * + * @path ch11/11.4/11.4.9/S11.4.9_A2.1_T1.js + * @description Either Type(x) is not Reference or GetBase(x) is not null + */ + +//CHECK#1 +if (!true !== false) { + $ERROR('#1: !true === false'); +} + +//CHECK#2 +if (!(!true) !== true) { + $ERROR('#2: !(!true) === true'); +} + +//CHECK#3 +var x = true; +if (!x !== false) { + $ERROR('#3: var x = true; !x === false'); +} + +//CHECK#4 +var x = true; +if (!(!x) !== true) { + $ERROR('#4: var x = true; !(!x) === true'); +} + +//CHECK#5 +var object = new Object(); +object.prop = true; +if (!object.prop !== false) { + $ERROR('#5: var object = new Object(); object.prop = true; !object.prop === false'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A2.1_T2.js b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A2.1_T2.js new file mode 100644 index 000000000..b6592471d --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A2.1_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. + +/** + * Operator !x uses GetValue + * + * @path ch11/11.4/11.4.9/S11.4.9_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + !x; + $ERROR('#1.1: !x throw ReferenceError. Actual: ' + (!x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: !x throw ReferenceError. Actual: ' + (e)); + } +} + + diff --git a/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A2.2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A2.2_T1.js new file mode 100644 index 000000000..3f156e9d4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A2.2_T1.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator !x uses [[Default Value]] + * + * @path ch11/11.4/11.4.9/S11.4.9_A2.2_T1.js + * @description If Type(value) is Object, return false + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (!object !== false) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (!object !== false) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (!object !== false) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#4 +var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +if (!object !== false) { + $ERROR('#4: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (!object !== false) { + $ERROR('#5: var object = {toString: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (!object !== false) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#7 +var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; +if (!object !== false) { + $ERROR('#7: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#8 +var object = {valueOf: function() {return {}}, toString: function() {return {}}}; +if (!object !== false) { + $ERROR('#8: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; !object === false. Actual: ' + (!object)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T1.js b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T1.js new file mode 100644 index 000000000..05a4ebcc7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_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. + +/** + * Operator !x returns !ToBoolean(x) + * + * @path ch11/11.4/11.4.9/S11.4.9_A3_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +if (!false !== true) { + $ERROR('#1: !false === true'); +} + +//CHECK#2 +if (!new Boolean(true) !== false) { + $ERROR('#2: !new Boolean(true) === false'); +} + +//CHECK#3 +if (!new Boolean(false) !== false) { + $ERROR('#3: !new Boolean(false) === false'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T2.js b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T2.js new file mode 100644 index 000000000..a2e13b0c0 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T2.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. + +/** + * Operator !x returns !ToBoolean(x) + * + * @path ch11/11.4/11.4.9/S11.4.9_A3_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +if (!0.1 !== false) { + $ERROR('#1: !0.1 === false'); +} + +//CHECK#2 +if (!new Number(-0.1) !== false) { + $ERROR('#2: !new Number(-0.1) === false'); +} + +//CHECK#3 +if (!NaN !== true) { + $ERROR('#3: !NaN === true'); +} + +//CHECK#4 +if (!new Number(NaN) !== false) { + $ERROR('#4: !new Number(NaN) === false'); +} + +//CHECK#5 +if (!0 !== true) { + $ERROR('#5: !0 === true'); +} + +//CHECK#6 +if (!new Number(0) !== false) { + $ERROR('#6: !new Number(0) === false'); +} + +//CHECK#7 +if (!Infinity !== false) { + $ERROR('#7: !Infinity === false'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T3.js b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T3.js new file mode 100644 index 000000000..a15994ddc --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T3.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. + +/** + * Operator !x returns !ToBoolean(x) + * + * @path ch11/11.4/11.4.9/S11.4.9_A3_T3.js + * @description Type(x) is string primitive or String object + */ + +//CHECK#1 +if (!"1" !== false) { + $ERROR('#1: !"1" === false'); +} + +//CHECK#2 +if (!new String("0") !== false) { + $ERROR('#2: !new String("0") === false'); +} + +//CHECK#3 +if (!"x" !== false) { + $ERROR('#3: !"x" === false'); +} + +//CHECK#4 +if (!"" !== true) { + $ERROR('#4: !"" === true'); +} + +//CHECK#5 +if (!new String("") !== false) { + $ERROR('#5: !new String("") === false'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T4.js b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T4.js new file mode 100644 index 000000000..0ac35bb98 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_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. + +/** + * Operator !x returns !ToBoolean(x) + * + * @path ch11/11.4/11.4.9/S11.4.9_A3_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +if (!void 0 !== true) { + $ERROR('#1: !void 0 === true'); +} + +//CHECK#2 +if (!null !== true) { + $ERROR('#2: !null === true'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T5.js b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T5.js new file mode 100644 index 000000000..88f6dcaec --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.9/S11.4.9_A3_T5.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. + +/** + * Operator !x returns !ToBoolean(x) + * + * @path ch11/11.4/11.4.9/S11.4.9_A3_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +if ((!{}) !== false) { + $ERROR('#1: !({}) === false'); +} + +//CHECK#2 +if (!(function(){return 1}) !== false) { + $ERROR('#2: !(function(){return 1}) === false'); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.9/browser.js b/js/src/tests/test262/ch11/11.4/11.4.9/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.9/browser.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.9/shell.js b/js/src/tests/test262/ch11/11.4/11.4.9/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.9/shell.js diff --git a/js/src/tests/test262/ch11/11.4/browser.js b/js/src/tests/test262/ch11/11.4/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/browser.js diff --git a/js/src/tests/test262/ch11/11.4/shell.js b/js/src/tests/test262/ch11/11.4/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/shell.js |