diff options
Diffstat (limited to 'js/src/tests/test262/ch10/10.6')
45 files changed, 1288 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch10/10.6/10.6-10-c-ii-1-s.js b/js/src/tests/test262/ch10/10.6/10.6-10-c-ii-1-s.js new file mode 100644 index 000000000..dcc3c49f9 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-10-c-ii-1-s.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.
+/**
+ * @path ch10/10.6/10.6-10-c-ii-1-s.js
+ * @description arguments[i] remains same after changing actual parameters in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ function foo(a,b,c)
+ {
+ 'use strict';
+ a = 1; b = 'str'; c = 2.1;
+ return (arguments[0] === 10 && arguments[1] === 'sss' && arguments[2] === 1);
+ }
+ return foo(10, 'sss', 1);
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-10-c-ii-1.js b/js/src/tests/test262/ch10/10.6/10.6-10-c-ii-1.js new file mode 100644 index 000000000..f0db64ee2 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-10-c-ii-1.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.
+/**
+ * @path ch10/10.6/10.6-10-c-ii-1.js
+ * @description arguments[i] change with actual parameters
+ */
+
+
+function testcase() {
+ function foo(a,b,c)
+ {
+ a = 1; b = 'str'; c = 2.1;
+ if(arguments[0] === 1 && arguments[1] === 'str' && arguments[2] === 2.1)
+ return true;
+ }
+ return foo(10,'sss',1);
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-10-c-ii-2-s.js b/js/src/tests/test262/ch10/10.6/10.6-10-c-ii-2-s.js new file mode 100644 index 000000000..58143f841 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-10-c-ii-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 ch10/10.6/10.6-10-c-ii-2-s.js
+ * @description arguments[i] doesn't map to actual parameters in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ function foo(a,b,c)
+ {
+ 'use strict';
+ arguments[0] = 1; arguments[1] = 'str'; arguments[2] = 2.1;
+ return 10 === a && 'sss' === b && 1 === c;
+ }
+ return foo(10,'sss',1);
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-10-c-ii-2.js b/js/src/tests/test262/ch10/10.6/10.6-10-c-ii-2.js new file mode 100644 index 000000000..5891dfe3b --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-10-c-ii-2.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.
+/**
+ * @path ch10/10.6/10.6-10-c-ii-2.js
+ * @description arguments[i] map to actual parameter
+ */
+
+
+function testcase() {
+
+ function foo(a,b,c)
+ {
+ arguments[0] = 1; arguments[1] = 'str'; arguments[2] = 2.1;
+ if(1 === a && 'str' === b && 2.1 === c)
+ return true;
+ }
+ return foo(10,'sss',1);
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-11-b-1.js b/js/src/tests/test262/ch10/10.6/10.6-11-b-1.js new file mode 100644 index 000000000..bcf937d63 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-11-b-1.js @@ -0,0 +1,54 @@ +/// 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 ch10/10.6/10.6-11-b-1.js
+ * @description Arguments Object has index property '0' as its own property, it shoulde be writable, enumerable, configurable and does not invoke the setter defined on Object.prototype[0] (Step 11.b)
+ */
+
+
+function testcase() {
+ try {
+ var data = "data";
+ var getFunc = function () {
+ return data;
+ };
+
+ var setFunc = function (value) {
+ data = value;
+ };
+
+ Object.defineProperty(Object.prototype, "0", {
+ get: getFunc,
+ set: setFunc,
+ configurable: true
+ });
+
+ var argObj = (function () { return arguments })(1);
+
+ var verifyValue = false;
+ verifyValue = (argObj[0] === 1);
+
+ var verifyEnumerable = false;
+ for (var p in argObj) {
+ if (p === "0" && argObj.hasOwnProperty("0")) {
+ verifyEnumerable = true;
+ }
+ }
+
+ var verifyWritable = false;
+ argObj[0] = 1001;
+ verifyWritable = (argObj[0] === 1001);
+
+ var verifyConfigurable = false;
+ delete argObj[0];
+ verifyConfigurable = argObj.hasOwnProperty("0");
+
+ return verifyValue && verifyWritable && verifyEnumerable && !verifyConfigurable && data === "data";
+ } finally {
+ delete Object.prototype[0];
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-12-1.js b/js/src/tests/test262/ch10/10.6/10.6-12-1.js new file mode 100644 index 000000000..12746eb1e --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-12-1.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.
+/**
+ * @path ch10/10.6/10.6-12-1.js
+ * @description Accessing callee property of Arguments object is allowed
+ */
+
+
+function testcase() {
+ try
+ {
+ arguments.callee;
+ return true;
+ }
+ catch (e) {
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-12-2.js b/js/src/tests/test262/ch10/10.6/10.6-12-2.js new file mode 100644 index 000000000..11a1793f4 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-12-2.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.
+/**
+ * @path ch10/10.6/10.6-12-2.js
+ * @description arguments.callee has correct attributes
+ */
+
+
+function testcase() {
+
+ var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
+ if(desc.configurable === true &&
+ desc.enumerable === false &&
+ desc.writable === true &&
+ desc.hasOwnProperty('get') == false &&
+ desc.hasOwnProperty('put') == false)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-13-1.js b/js/src/tests/test262/ch10/10.6/10.6-13-1.js new file mode 100644 index 000000000..d871a9ccb --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-13-1.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.
+/**
+ * @path ch10/10.6/10.6-13-1.js
+ * @description Accessing caller property of Arguments object is allowed
+ */
+
+
+function testcase() {
+ try
+ {
+ arguments.caller;
+ return true;
+ }
+ catch (e) {
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-13-a-1.js b/js/src/tests/test262/ch10/10.6/10.6-13-a-1.js new file mode 100644 index 000000000..a7b3f2ee6 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-13-a-1.js @@ -0,0 +1,45 @@ +/// 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 ch10/10.6/10.6-13-a-1.js
+ * @description In non-strict mode, arguments object should have its own 'callee' property defined (Step 13.a)
+ */
+
+
+function testcase() {
+ try {
+ Object.defineProperty(Object.prototype, "callee", {
+ value: 1,
+ writable: false,
+ configurable: true
+ });
+
+ var argObj = (function () { return arguments })();
+
+ var verifyValue = false;
+ verifyValue = typeof argObj.callee === "function";
+
+ var verifyWritable = false;
+ argObj.callee = 1001;
+ verifyWritable = (argObj.callee === 1001);
+
+ var verifyEnumerable = false;
+ for (var p in argObj) {
+ if (p === "callee" && argObj.hasOwnProperty("callee")) {
+ verifyEnumerable = true;
+ }
+ }
+
+ var verifyConfigurable = false;
+ delete argObj.callee;
+ verifyConfigurable = argObj.hasOwnProperty("callee");
+
+ return verifyValue && verifyWritable && !verifyEnumerable && !verifyConfigurable;
+ } finally {
+ delete Object.prototype.callee;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-13-a-2.js b/js/src/tests/test262/ch10/10.6/10.6-13-a-2.js new file mode 100644 index 000000000..b68171258 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-13-a-2.js @@ -0,0 +1,35 @@ +/// 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 ch10/10.6/10.6-13-a-2.js
+ * @description A direct call to arguments.callee.caller should work
+ */
+
+
+function testcase() {
+ var called = false;
+
+ function test1(flag) {
+ if (flag!==true) {
+ test2();
+ } else {
+ called = true;
+ }
+ }
+
+ function test2() {
+ if(arguments.callee.caller===undefined) {
+ called=true; // Extension not supported - fake it
+ } else {
+ arguments.callee.caller(true);
+ }
+ }
+
+ test1();
+ return called;
+}
+
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch10/10.6/10.6-13-a-3.js b/js/src/tests/test262/ch10/10.6/10.6-13-a-3.js new file mode 100644 index 000000000..ddd03a68c --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-13-a-3.js @@ -0,0 +1,36 @@ +/// 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 ch10/10.6/10.6-13-a-3.js
+ * @description An indirect call to arguments.callee.caller should work
+ */
+
+
+function testcase() {
+ var called = false;
+
+ function test1(flag) {
+ if (flag!==true) {
+ test2();
+ } else {
+ called = true;
+ }
+ }
+
+ function test2() {
+ if (arguments.callee.caller===undefined) {
+ called = true; //Extension not supported - fake it
+ } else {
+ var explicit = arguments.callee.caller;
+ explicit(true);
+ }
+ }
+
+ test1();
+ return called;
+}
+
+runTestCase(testcase);
\ No newline at end of file diff --git a/js/src/tests/test262/ch10/10.6/10.6-13-b-1-s.js b/js/src/tests/test262/ch10/10.6/10.6-13-b-1-s.js new file mode 100644 index 000000000..d44b475af --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-13-b-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 ch10/10.6/10.6-13-b-1-s.js
+ * @description Accessing caller property of Arguments object throws TypeError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+ try
+ {
+ arguments.caller;
+ }
+ catch (e) {
+ if(e instanceof TypeError)
+ return true;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-13-b-2-s.js b/js/src/tests/test262/ch10/10.6/10.6-13-b-2-s.js new file mode 100644 index 000000000..0f1b2b764 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-13-b-2-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 ch10/10.6/10.6-13-b-2-s.js
+ * @description arguments.caller exists in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ 'use strict';
+ var desc = Object.getOwnPropertyDescriptor(arguments,"caller");
+ return desc!== undefined;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-13-b-3-s.js b/js/src/tests/test262/ch10/10.6/10.6-13-b-3-s.js new file mode 100644 index 000000000..d85e084f1 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-13-b-3-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 ch10/10.6/10.6-13-b-3-s.js
+ * @description arguments.caller is non-configurable in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ 'use strict';
+ var desc = Object.getOwnPropertyDescriptor(arguments,"caller");
+
+ return (desc.configurable === false &&
+ desc.enumerable === false &&
+ desc.hasOwnProperty('value') == false &&
+ desc.hasOwnProperty('writable') == false &&
+ desc.hasOwnProperty('get') == true &&
+ desc.hasOwnProperty('set') == true);
+
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-13-c-1-s.js b/js/src/tests/test262/ch10/10.6/10.6-13-c-1-s.js new file mode 100644 index 000000000..f17a9b37b --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-13-c-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 ch10/10.6/10.6-13-c-1-s.js
+ * @description Accessing callee property of Arguments object throws TypeError in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+ try
+ {
+ arguments.callee;
+ return false;
+ }
+ catch (e) {
+ return (e instanceof TypeError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-13-c-2-s.js b/js/src/tests/test262/ch10/10.6/10.6-13-c-2-s.js new file mode 100644 index 000000000..e08e77003 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-13-c-2-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 ch10/10.6/10.6-13-c-2-s.js
+ * @description arguments.callee is exists in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ 'use strict';
+ var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
+ return desc !== undefined;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-13-c-3-s.js b/js/src/tests/test262/ch10/10.6/10.6-13-c-3-s.js new file mode 100644 index 000000000..8122932bd --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-13-c-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 ch10/10.6/10.6-13-c-3-s.js
+ * @description arguments.callee is non-configurable in strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ 'use strict';
+ var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
+ return (desc.configurable === false &&
+ desc.enumerable === false &&
+ desc.hasOwnProperty('value') == false &&
+ desc.hasOwnProperty('writable') == false &&
+ desc.hasOwnProperty('get') == true &&
+ desc.hasOwnProperty('set') == true);
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-14-1-s.js b/js/src/tests/test262/ch10/10.6/10.6-14-1-s.js new file mode 100644 index 000000000..aebc6fa1c --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-14-1-s.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 ch10/10.6/10.6-14-1-s.js
+ * @description Strict Mode - 'callee' exists and 'caller' exists under strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var argObj = function () {
+ return arguments;
+ } ();
+ return argObj.hasOwnProperty("callee") && argObj.hasOwnProperty("caller");
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-14-b-1-s.js b/js/src/tests/test262/ch10/10.6/10.6-14-b-1-s.js new file mode 100644 index 000000000..51cbfff4d --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-14-b-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 ch10/10.6/10.6-14-b-1-s.js
+ * @description Strict Mode - [[Enumerable]] attribute value in 'caller' is false under strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ var argObj = function () {
+ return arguments;
+ } ();
+
+ var verifyEnumerable = false;
+ for (var _10_6_14_b_1 in argObj) {
+ if (argObj.hasOwnProperty(_10_6_14_b_1) && _10_6_14_b_1 === "caller") {
+ verifyEnumerable = true;
+ }
+ }
+ return !verifyEnumerable && argObj.hasOwnProperty("caller");
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-14-b-4-s.js b/js/src/tests/test262/ch10/10.6/10.6-14-b-4-s.js new file mode 100644 index 000000000..748c630a9 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-14-b-4-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.
+/**
+ * @path ch10/10.6/10.6-14-b-4-s.js
+ * @description Strict Mode - TypeError is thrown when accessing the [[Set]] attribute in 'caller' under strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ var argObj = function () {
+ return arguments;
+ } ();
+
+ try {
+ argObj.caller = {};
+ return false;
+ } catch (e) {
+ return e instanceof TypeError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-14-c-1-s.js b/js/src/tests/test262/ch10/10.6/10.6-14-c-1-s.js new file mode 100644 index 000000000..cade0a537 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-14-c-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 ch10/10.6/10.6-14-c-1-s.js
+ * @description Strict Mode - [[Enumerable]] attribute value in 'callee' is false under strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ var argObj = function () {
+ return arguments;
+ } ();
+
+ var verifyEnumerable = false;
+ for (var _10_6_14_c_1 in argObj) {
+ if (argObj.hasOwnProperty(_10_6_14_c_1) && _10_6_14_c_1 === "callee") {
+ verifyEnumerable = true;
+ }
+ }
+ return !verifyEnumerable && argObj.hasOwnProperty("callee");
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-14-c-4-s.js b/js/src/tests/test262/ch10/10.6/10.6-14-c-4-s.js new file mode 100644 index 000000000..1238570c4 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-14-c-4-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.
+/**
+ * @path ch10/10.6/10.6-14-c-4-s.js
+ * @description Strict Mode - TypeError is thrown when accessing the [[Set]] attribute in 'callee' under strict mode
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ var argObj = function () {
+ return arguments;
+ } ();
+
+ try {
+ argObj.callee = {};
+ return false;
+ } catch (e) {
+ return e instanceof TypeError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-1gs.js b/js/src/tests/test262/ch10/10.6/10.6-1gs.js new file mode 100644 index 000000000..f77fd3c57 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-1gs.js @@ -0,0 +1,17 @@ +/// 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 ch10/10.6/10.6-1gs.js
+ * @description Strict Mode - arguments.callee cannot be accessed in a strict function, but does not throw an early error
+ * @onlyStrict
+ */
+
+"use strict";
+function f_10_6_1_gs(){
+ return arguments.callee;
+}
+
diff --git a/js/src/tests/test262/ch10/10.6/10.6-2gs.js b/js/src/tests/test262/ch10/10.6/10.6-2gs.js new file mode 100644 index 000000000..e13cc02f5 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-2gs.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 ch10/10.6/10.6-2gs.js
+ * @description Strict Mode - arguments.callee cannot be accessed in a strict function
+ * @onlyStrict
+ * @negative .
+ */
+
+"use strict";
+function f_10_6_1_gs(){
+ return arguments.callee;
+}
+f_10_6_1_gs();
+
diff --git a/js/src/tests/test262/ch10/10.6/10.6-5-1.js b/js/src/tests/test262/ch10/10.6/10.6-5-1.js new file mode 100644 index 000000000..f058239fe --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-5-1.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 ch10/10.6/10.6-5-1.js
+ * @description [[Prototype]] property of Arguments is set to Object prototype object
+ */
+
+
+function testcase() {
+ if(Object.getPrototypeOf(arguments) === Object.getPrototypeOf({}))
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-6-1.js b/js/src/tests/test262/ch10/10.6/10.6-6-1.js new file mode 100644 index 000000000..d0ec15e27 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-6-1.js @@ -0,0 +1,17 @@ +/// 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 ch10/10.6/10.6-6-1.js
+ * @description 'length property of arguments object exists
+ */
+
+
+function testcase() {
+
+ var desc = Object.getOwnPropertyDescriptor(arguments,"length");
+ return desc !== undefined
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-6-2.js b/js/src/tests/test262/ch10/10.6/10.6-6-2.js new file mode 100644 index 000000000..afad35fd0 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-6-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 ch10/10.6/10.6-6-2.js
+ * @description 'length' property of arguments object has correct attributes
+ */
+
+
+function testcase() {
+
+ var desc = Object.getOwnPropertyDescriptor(arguments,"length");
+ if(desc.configurable === true &&
+ desc.enumerable === false &&
+ desc.writable === true )
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-6-3.js b/js/src/tests/test262/ch10/10.6/10.6-6-3.js new file mode 100644 index 000000000..e7838e8a4 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-6-3.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 ch10/10.6/10.6-6-3.js
+ * @description 'length' property of arguments object for 0 argument function exists
+ */
+
+
+function testcase() {
+ var arguments= undefined;
+ return (function () {return arguments.length !== undefined})();
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-6-4.js b/js/src/tests/test262/ch10/10.6/10.6-6-4.js new file mode 100644 index 000000000..6a3a77b23 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-6-4.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 ch10/10.6/10.6-6-4.js
+ * @description 'length' property of arguments object for 0 argument function call is 0 even with formal parameters
+ */
+
+
+function testcase() {
+ var arguments= undefined;
+ return (function (a,b,c) {return arguments.length === 0})();
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/10.6-7-1.js b/js/src/tests/test262/ch10/10.6/10.6-7-1.js new file mode 100644 index 000000000..30fd4f373 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/10.6-7-1.js @@ -0,0 +1,53 @@ +/// 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 ch10/10.6/10.6-7-1.js
+ * @description Arguments Object has length as its own property and does not invoke the setter defined on Object.prototype.length (Step 7)
+ */
+
+
+function testcase() {
+ try {
+ var data = "data";
+ var getFunc = function () {
+ return 12;
+ };
+
+ var setFunc = function (value) {
+ data = value;
+ };
+
+ Object.defineProperty(Object.prototype, "length", {
+ get: getFunc,
+ set: setFunc,
+ configurable: true
+ });
+
+ var verifyValue = false;
+ var argObj = (function () { return arguments })();
+ verifyValue = (argObj.length === 0);
+
+ var verifyWritable = false;
+ argObj.length = 1001;
+ verifyWritable = (argObj.length === 1001);
+
+ var verifyEnumerable = false;
+ for (var p in argObj) {
+ if (p === "length") {
+ verifyEnumerable = true;
+ }
+ }
+
+ var verifyConfigurable = false;
+ delete argObj.length;
+ verifyConfigurable = argObj.hasOwnProperty("length");
+
+ return verifyValue && verifyWritable && !verifyEnumerable && !verifyConfigurable && data === "data";
+ } finally {
+ delete Object.prototype.length;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A1.js b/js/src/tests/test262/ch10/10.6/S10.6_A1.js new file mode 100644 index 000000000..89df9c4dd --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * When control enters an execution context for function code, + * an arguments object is created and initialised + * + * @path ch10/10.6/S10.6_A1.js + * @description Executing function which uses arguments object + */ + +//CHECK#1 +function f1(){ + return arguments; +} + +try{ + var x = f1(); +} +catch(e){ + $ERROR("#1: arguments doesn't exists"); +} + +//CHECK#2 +var f2 = function(){ + return arguments; +} + +try{ + var x = f2(); +} +catch(e){ + $ERROR("#2: arguments doesn't exists"); +} + diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A2.js b/js/src/tests/test262/ch10/10.6/S10.6_A2.js new file mode 100644 index 000000000..18698be00 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A2.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The value of the internal [[Prototype]] property of the + * created arguments object is the original Object prototype object, the one + * that is the initial value of Object.prototype + * + * @path ch10/10.6/S10.6_A2.js + * @description Checking arguments.constructor.prototype===Object.prototype + */ + +//CHECK#1 +function f1(){ + return arguments.constructor.prototype; +} +try{ + if(f1() !== Object.prototype){ + $ERROR('#1: arguments.constructor.prototype === Object.prototype'); + } +} +catch(e){ + $ERROR("#1: arguments doesn't exists"); +} + +//CHECK#2 +var f2 = function(){return arguments.constructor.prototype;}; +try{ + if(f2() !== Object.prototype){ + $ERROR('#2: arguments.constructor.prototype === Object.prototype'); + } +} +catch(e){ + $ERROR("#2: arguments doesn't exists"); +} + diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A3_T1.js b/js/src/tests/test262/ch10/10.6/S10.6_A3_T1.js new file mode 100644 index 000000000..234d6ad1a --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A3_T1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name callee with property + * attributes { DontEnum } and no others + * + * @path ch10/10.6/S10.6_A3_T1.js + * @description Checking existence of arguments.callee property + */ + +//CHECK#1 +function f1(){ + return arguments.hasOwnProperty("callee"); +} +try{ + if(f1() !== true){ + $ERROR("#1: arguments object doesn't contains property 'callee'"); + } +} +catch(e){ + $ERROR("#1: arguments object doesn't exists"); +} + +//CHECK#2 +var f2 = function(){return arguments.hasOwnProperty("callee");}; +try{ + if(f2() !== true){ + $ERROR("#2: arguments object doesn't contains property 'callee'"); + } +} +catch(e){ + $ERROR("#2: arguments object doesn't exists"); +} + diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A3_T2.js b/js/src/tests/test262/ch10/10.6/S10.6_A3_T2.js new file mode 100644 index 000000000..327e5cf36 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A3_T2.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name callee with property + * attributes { DontEnum } and no others + * + * @path ch10/10.6/S10.6_A3_T2.js + * @description Checking if enumerating the arguments.callee property fails + */ + +//CHECK#1 +function f1(){ + for(var x in arguments){ + if (x === "callee"){ + return false; + } + } + return true; +} + +try{ + if(!f1()){ + $ERROR("#1: A property callee don't have attribute { DontEnum }"); + } +} +catch(e){ + $ERROR("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + for(var x in arguments){ + if (x === "callee"){ + return false; + } + } + return true; +} + +try{ + if(!f2()){ + $ERROR("#2: A property callee don't have attribute { DontEnum }"); + } +} +catch(e){ + $ERROR("#2: arguments object don't exists"); +} + diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A3_T3.js b/js/src/tests/test262/ch10/10.6/S10.6_A3_T3.js new file mode 100644 index 000000000..4b2626570 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A3_T3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name callee with property + * attributes { DontEnum } and no others + * + * @path ch10/10.6/S10.6_A3_T3.js + * @description Checking if deleting arguments.callee property fails + * @noStrict + */ + +//CHECK#1 +function f1(){ + return (delete arguments.callee); +} + +try{ + if(!f1()){ + $ERROR("#1: A property callee have attribute { DontDelete }"); + } +} +catch(e){ + $ERROR("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + return (delete arguments.callee); +} + +try{ + if(!f2()){ + $ERROR("#2: A property callee have attribute { DontDelete }"); + } +} +catch(e){ + $ERROR("#2: arguments object don't exists"); +} + diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A3_T4.js b/js/src/tests/test262/ch10/10.6/S10.6_A3_T4.js new file mode 100644 index 000000000..c83983507 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A3_T4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name callee with property + * attributes { DontEnum } and no others + * + * @path ch10/10.6/S10.6_A3_T4.js + * @description Overriding arguments.callee property + * @noStrict + */ + +var str = "something different"; +//CHECK#1 +function f1(){ + arguments.callee = str; + return arguments; +} + +try{ + if(f1().callee !== str){ + $ERROR("#1: A property callee have attribute { ReadOnly }"); + } +} +catch(e){ + $ERROR("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + arguments.callee = str; + return arguments; + } +try{ + if(f2().callee !== str){ + $ERROR("#2: A property callee have attribute { ReadOnly }"); + } +} +catch(e){ + $ERROR("#2: arguments object don't exists"); +} + diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A4.js b/js/src/tests/test262/ch10/10.6/S10.6_A4.js new file mode 100644 index 000000000..b49902a45 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A4.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The initial value of the created property callee is the + * Function object being executed + * + * @path ch10/10.6/S10.6_A4.js + * @description Checking that arguments.callee === function object + * @noStrict + */ + +//CHECK#1 +function f1(){ + return arguments.callee; +} + +try{ + if(f1 !== f1()){ + $ERROR('#1: arguments.callee === f1'); + } +} +catch(e){ + $ERROR("#1: arguments object doesn't exists"); +} + +//CHECK#2 +var f2 = function(){return arguments.callee;}; + +try{ + if(f2 !== f2()){ + $ERROR('#2: arguments.callee === f2'); + } +} +catch(e){ + $ERROR("#1: arguments object doesn't exists"); +} + diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A5_T1.js b/js/src/tests/test262/ch10/10.6/S10.6_A5_T1.js new file mode 100644 index 000000000..a76e58d47 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A5_T1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name length with property + * attributes { DontEnum } and no others + * + * @path ch10/10.6/S10.6_A5_T1.js + * @description Checking existence of arguments.length property + */ + +//CHECK#1 +function f1(){ + return arguments.hasOwnProperty("length"); +} +try{ + if(f1() !== true){ + $ERROR("#1: arguments object doesn't contains property 'length'"); + } +} +catch(e){ + $ERROR("#1: arguments object doesn't exists"); +} + +//CHECK#2 +var f2 = function(){return arguments.hasOwnProperty("length");}; +try{ + if(f2() !== true){ + $ERROR("#2: arguments object doesn't contains property 'length'"); + } +} +catch(e){ + $ERROR("#2: arguments object doesn't exists"); +} + diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A5_T2.js b/js/src/tests/test262/ch10/10.6/S10.6_A5_T2.js new file mode 100644 index 000000000..a0f4df7a9 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A5_T2.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name length with property + * attributes { DontEnum } and no others + * + * @path ch10/10.6/S10.6_A5_T2.js + * @description Checking if enumerating the arguments.length property fails + */ + +//CHECK#1 +function f1(){ + for(var x in arguments){ + if (x === "length"){ + return false; + } + } + return true; +} + +try{ + if(!f1()){ + $ERROR("#1: A property length don't have attribute { DontEnum }"); + } +} +catch(e){ + $ERROR("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + for(var x in arguments){ + if (x === "length"){ + return false; + } + } + return true; +} + +try{ + if(!f2()){ + $ERROR("#2: A property length don't have attribute { DontEnum }"); + } +} +catch(e){ + $ERROR("#2: arguments object don't exists"); +} + diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A5_T3.js b/js/src/tests/test262/ch10/10.6/S10.6_A5_T3.js new file mode 100644 index 000000000..c8187fac8 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A5_T3.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name length with property + * attributes { DontEnum } and no others + * + * @path ch10/10.6/S10.6_A5_T3.js + * @description Checking if deleting arguments.length property fails + */ + +//CHECK#1 +function f1(){ + return (delete arguments.length); +} + +try{ + if(!f1()){ + $ERROR("#1: A property length have attribute { DontDelete }"); + } +} +catch(e){ + $ERROR("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + return (delete arguments.length); +} + +try{ + if(!f2()){ + $ERROR("#2: A property length have attribute { DontDelete }"); + } +} +catch(e){ + $ERROR("#2: arguments object don't exists"); +} + diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A5_T4.js b/js/src/tests/test262/ch10/10.6/S10.6_A5_T4.js new file mode 100644 index 000000000..7178bf424 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A5_T4.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A property is created with name length with property + * attributes { DontEnum } and no others + * + * @path ch10/10.6/S10.6_A5_T4.js + * @description Overriding arguments.length property + */ + +var str = "something different"; +//CHECK#1 +function f1(){ + arguments.length = str; + return arguments; +} + +try{ + if(f1().length !== str){ + $ERROR("#1: A property length have attribute { ReadOnly }"); + } +} +catch(e){ + $ERROR("#1: arguments object don't exists"); +} + +//CHECK#2 +var f2 = function(){ + arguments.length = str; + return arguments; + }; +try{ + if(f2().length !== str){ + $ERROR("#2: A property length have attribute { ReadOnly }"); + } +} +catch(e){ + $ERROR("#2: arguments object don't exists"); +} + diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A6.js b/js/src/tests/test262/ch10/10.6/S10.6_A6.js new file mode 100644 index 000000000..3f1d0d1c1 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A6.js @@ -0,0 +1,67 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The initial value of the created property length is the number + * of actual parameter values supplied by the caller + * + * @path ch10/10.6/S10.6_A6.js + * @description Create function, that returned arguments.length + */ + +function f1(){ + return arguments.length; +} + +//CHECK#1 +if(!(f1() === 0)){ + $ERROR('#1: argument.length === 0'); +} + +//CHECK#2 +if(!(f1(0) === 1)){ + $ERROR('#2: argument.length === 1'); +} + +//CHECK#3 +if(!(f1(0, 1) === 2)){ + $ERROR('#3: argument.length === 2'); +} + +//CHECK#4 +if(!(f1(0, 1, 2) === 3)){ + $ERROR('#4: argument.length === 3'); +} + +//CHECK#5 +if(!(f1(0, 1, 2, 3) === 4)){ + $ERROR('#5: argument.length === 4'); +} + +var f2 = function(){return arguments.length;}; + +//CHECK#6 +if(!(f2() === 0)){ + $ERROR('#6: argument.length === 0'); +} + +//CHECK#7 +if(!(f2(0) === 1)){ + $ERROR('#7: argument.length === 1'); +} + +//CHECK#8 +if(!(f2(0, 1) === 2)){ + $ERROR('#8: argument.length === 2'); +} + +//CHECK#9 +if(!(f2(0, 1, 2) === 3)){ + $ERROR('#9: argument.length === 3'); +} + +//CHECK#10 +if(!(f2(0, 1, 2, 3) === 4)){ + $ERROR('#10: argument.length === 4'); +} + diff --git a/js/src/tests/test262/ch10/10.6/S10.6_A7.js b/js/src/tests/test262/ch10/10.6/S10.6_A7.js new file mode 100644 index 000000000..f013ba013 --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/S10.6_A7.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Get arguments of function + * + * @path ch10/10.6/S10.6_A7.js + * @description Use property arguments + */ + +function f1() { + return arguments; +} + +//CHECK#1-5 +for(var i = 1; i < 5; i++){ +if (f1(1,2,3,4,5)[i] !== (i+1)) + $ERROR("#"+i+": Returning function's arguments work wrong, f1(1,2,3,4,5)["+i+"] !== "+(i+1)); +} + diff --git a/js/src/tests/test262/ch10/10.6/browser.js b/js/src/tests/test262/ch10/10.6/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/browser.js diff --git a/js/src/tests/test262/ch10/10.6/shell.js b/js/src/tests/test262/ch10/10.6/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch10/10.6/shell.js |