summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/for-of/array-iterator-surfaces-1.js
blob: 6757acb3e53026e074630311ddf3da43f159d20b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Superficial tests of the Array.prototype[@@iterator] builtin function and its workalikes.

load(libdir + "iteration.js");

var constructors = [Array, String, Uint8Array, Uint8ClampedArray];
for (var c of constructors) {
    assertEq(c.prototype[Symbol.iterator].length, 0);

    var loc = (c === Array || c === String)
            ? c.prototype
            : Object.getPrototypeOf(c.prototype);

    var desc = Object.getOwnPropertyDescriptor(loc, Symbol.iterator);
    assertEq(desc.configurable, true);
    assertEq(desc.enumerable, false);
    assertEq(desc.writable, true);
}