]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/array-map-put-by-val-direct.js
1 function shouldBe(actual
, expected
) {
2 if (actual
!== expected
)
3 throw new Error('bad value: ' + actual
);
6 for (var i
= 0; i
< 10; ++i
) {
7 Object
.defineProperty(Array
.prototype, i
, {
9 throw new Error('get is called.');
12 throw new Error('set is called.');
17 var original
= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
19 // Doesn't throw any errors.
20 var mapped
= original
.map(function (value
) {
24 shouldBe(mapped
.length
, 10);
25 for (var i
= 0; i
< 10; ++i
) {
26 shouldBe(mapped
[i
], i
* 2);