summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/iterator-1.js
blob: 4b656b879c3cd7bcc04d3d95f3a471da6119029d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// collection.iterator() returns an iterator object.

load(libdir + "iteration.js");

function test(obj, name) {
    var iter = obj[Symbol.iterator]();
    assertEq(typeof iter, "object");
    assertEq(iter instanceof Iterator, false); // Not a legacy Iterator.
    assertEq(iter.toString(), "[object " + obj.constructor.name + " Iterator]");
}

test([]);
test(new Map);
test(new Set);