summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Tuple/from/iter-set-length.js
blob: 8515ea2bd99929837123f5a404e074aea1ef94e7 (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
// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
var items = {};
var result, nextIterResult, lastIterResult;
items[Symbol.iterator] = function() {
  return {
    next: function() {
      var result = nextIterResult;
      nextIterResult = lastIterResult;
      return result;
    }
  };
};

nextIterResult = lastIterResult = {
  done: true
};
result = Tuple.from(items);

assertEq(result.length, 0);

nextIterResult = {
  done: false
};
lastIterResult = {
  done: true
};
result = Tuple.from(items);

assertEq(result.length, 1);

reportCompare(0, 0);