js/src/jit-test/tests/collections/iterator-proto-1.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/collections/iterator-proto-1.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,15 @@
     1.4 +// All iterators of the same collection type share their immediate prototype.
     1.5 +// Those prototype objects in turn inherit directly from Iterator.prototype.
     1.6 +
     1.7 +load(libdir + "iteration.js");
     1.8 +
     1.9 +function test(obj0, obj1) {
    1.10 +    var iter0 = obj0[std_iterator](), iter1 = obj1[std_iterator]();
    1.11 +    var proto = Object.getPrototypeOf(iter0);
    1.12 +    assertEq(Object.getPrototypeOf(iter1), proto);
    1.13 +    assertEq(Object.getPrototypeOf(proto), Iterator.prototype);
    1.14 +}
    1.15 +
    1.16 +test([], [1]);
    1.17 +test(Map(), Map([[1, 1]]));
    1.18 +test(Set(), Set([1]));

mercurial