summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Array-of-ordering.js
blob: 5906e1b4986e20e8c183483eeb6148438fea0e83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Order of Array.of operations.

load(libdir + "asserts.js");

var log;

var dstdata = [];
var dst = new Proxy(dstdata, {
    defineProperty: function (t, name, desc) {
        log.push(["def", name, desc.value]);
        return true;
    },
    set: function (t, name, value) {
        log.push(["set", name, value]);
        return true;
    }
});

function Troop() {
    return dst;
}
Troop.of = Array.of;

log = [];
assertEq(Troop.of("monkeys", "baboons", "kangaroos"), dst);
assertDeepEq(log, [
    ["def", "0", "monkeys"],
    ["def", "1", "baboons"],
    ["def", "2", "kangaroos"],
    ["set", "length", 3]
]);