]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/arguments-bizarre-behavior.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / arguments-bizarre-behavior.js
1 function foo(x) {
2 Object.defineProperty(arguments, 0, {configurable: true, enumerable: true, writable:true, value:42});
3 return [x, arguments[0], arguments]
4 }
5
6 var result = foo(1);
7
8 if (result[0] !== 42)
9 throw new Error();
10
11 if (result[1] !== 42)
12 throw new Error();
13
14 if (Array.prototype.join.call(result[2], ",") != "42")
15 throw new Error();
16
17 var array = [];
18 for (var s in result[2])
19 array.push(s);
20
21 if (array.join(",") != "0")
22 throw new Error();
23
24 if (Object.keys(result[2]).join(",") != "0")
25 throw new Error();