summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/Set-add-size.js
blob: dfd131db67650cf3c89d4bb1a71838d23468bcd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
// set.add(v) increments set.size iff the set did not already contain v.

var s = new Set();
for (var i = 0; i < 10; i++) {
    assertEq(s.size, i);
    s.add(i);
}
for (var i = 0; i < 10; i++) {
    assertEq(s.size, 10);
    s.add(i);
}