]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/for-in-modify-int-loop-var.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / for-in-modify-int-loop-var.js
CommitLineData
ed1e77d3
A
1(function() {
2 // Change integer value of the loop variable in the loop.
3 var foo = function() {
4 var a = [1, 2, 3];
5 var sum = 0;
6 for (var i in a) {
7 i += 10;
8 sum += i;
9 }
10 return sum;
11 };
12 noInline(foo);
13 for (var i = 0; i < 10000; ++i) {
14 var result = foo();
15 if (typeof result !== "string")
16 throw new Error("result should have type string");
17 if (result !== "0010110210")
18 throw new Error("bad result");
19 }
20 foo(null);
21})();