Index: test/webkit/legitimately-captured-argument.js |
diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/legitimately-captured-argument.js |
similarity index 79% |
copy from test/webkit/concat-while-having-a-bad-time.js |
copy to test/webkit/legitimately-captured-argument.js |
index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..a7290e5e1b0005710172a419d08f0f3f2500fdd5 100644 |
--- a/test/webkit/concat-while-having-a-bad-time.js |
+++ b/test/webkit/legitimately-captured-argument.js |
@@ -22,10 +22,17 @@ |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
description( |
-"Tests the behavior of Array.prototype.concat while the array is having a bad time due to one of the elements we are concatenating." |
+"Tests that using an argument as a captured variable, in the legitimate sense rather than the function.arguments sense, works as expected." |
); |
-Object.defineProperty(Array.prototype, 0, { writable: false }); |
-shouldBe("[42].concat()", "[42]"); |
- |
+function makeCounter(x) { |
+ return function() { |
+ return ++x; |
+ }; |
+} |
+for (var i = 0; i < 100; ++i) { |
+ var counter = makeCounter(i); |
+ for (var j = 0; j < 10; ++j) |
+ shouldBe("counter()", "" + (i + j + 1)); |
+} |