js/src/jit-test/tests/for-of/array-iterator-shrinking.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/for-of/array-iterator-shrinking.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +// If an array is truncated to the left of an iterator it, it.next() returns { done: true }.
     1.5 +
     1.6 +load(libdir + "asserts.js");
     1.7 +load(libdir + "iteration.js");
     1.8 +
     1.9 +var arr = [0, 1, 2];
    1.10 +var it = arr[std_iterator]();
    1.11 +var ki = arr.keys();
    1.12 +var ei = arr.entries();
    1.13 +
    1.14 +assertIteratorNext(it, 0);
    1.15 +assertIteratorNext(it, 1);
    1.16 +assertIteratorNext(ki, 0);
    1.17 +assertIteratorNext(ki, 1);
    1.18 +assertIteratorNext(ei, [0, 0]);
    1.19 +assertIteratorNext(ei, [1, 1]);
    1.20 +arr.length = 1;
    1.21 +assertIteratorDone(it, undefined);
    1.22 +assertIteratorDone(ki, undefined);
    1.23 +assertIteratorDone(ei, undefined);

mercurial