Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 /// Copyright (c) 2012 Ecma International. All rights reserved.
2 /// Ecma International makes this code available under the terms and conditions set
3 /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
4 /// "Use Terms"). Any redistribution of this code must retain the above
5 /// copyright and this notice and otherwise comply with the Use Terms.
6 /**
7 * @path ch10/10.6/10.6-11-b-1.js
8 * @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)
9 */
12 function testcase() {
13 try {
14 var data = "data";
15 var getFunc = function () {
16 return data;
17 };
19 var setFunc = function (value) {
20 data = value;
21 };
23 Object.defineProperty(Object.prototype, "0", {
24 get: getFunc,
25 set: setFunc,
26 configurable: true
27 });
29 var argObj = (function () { return arguments })(1);
31 var verifyValue = false;
32 verifyValue = (argObj[0] === 1);
34 var verifyEnumerable = false;
35 for (var p in argObj) {
36 if (p === "0" && argObj.hasOwnProperty("0")) {
37 verifyEnumerable = true;
38 }
39 }
41 var verifyWritable = false;
42 argObj[0] = 1001;
43 verifyWritable = (argObj[0] === 1001);
45 var verifyConfigurable = false;
46 delete argObj[0];
47 verifyConfigurable = argObj.hasOwnProperty("0");
49 return verifyValue && verifyWritable && verifyEnumerable && !verifyConfigurable && data === "data";
50 } finally {
51 delete Object.prototype[0];
52 }
53 }
54 runTestCase(testcase);