]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/array-from-with-accessors.js
1 function shouldBe(actual
, expected
) {
2 if (actual
!== expected
)
3 throw new Error('bad value: ' + actual
);
6 var array
= [0, 1, 2, 3, 4, 5];
7 Object
.defineProperty(Array
.prototype, '0', {
9 throw new Error('cannot get to 0 getter');
12 throw new Error('cannot put to 0 setter');
16 var result
= Array
.from(array
);
17 shouldBe(result
.length
, array
.length
);
18 shouldBe(result
instanceof Array
, true);
20 for (var i
= 0; i
< array
.length
; ++i
)
21 shouldBe(result
[i
], array
[i
]);