diff options
Diffstat (limited to 'js/src/jit-test/tests/basic/testClosures.js')
-rw-r--r-- | js/src/jit-test/tests/basic/testClosures.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/testClosures.js b/js/src/jit-test/tests/basic/testClosures.js new file mode 100644 index 000000000..a8152c209 --- /dev/null +++ b/js/src/jit-test/tests/basic/testClosures.js @@ -0,0 +1,18 @@ +function testClosures() +{ + function MyObject(id) { + var thisObject = this; + this.id = id; + this.toString = str; + + function str() { + return "" + this.id + thisObject.id; + } + } + + var a = []; + for (var i = 0; i < 5; i++) + a.push(new MyObject(i)); + return a.toString(); +} +assertEq(testClosures(), "00,11,22,33,44"); |