summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Tuple/from/iter-set-elem-prop.js
blob: 0cf1452d0ae4939fe2e337e7ef6c445d6df8186d (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
33
34
35
36
37
// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
var items = {};
var firstIterResult = {
  done: false,
  value: 1
};
var secondIterResult = {
  done: false,
  value: 2
};
var thirdIterResult = {
  done: true,
  value: 3
};
var nextIterResult = firstIterResult;
var nextNextIterResult = secondIterResult;
var result;

items[Symbol.iterator] = function() {
  return {
    next: function() {
      var result = nextIterResult;

      nextIterResult = nextNextIterResult;
      nextNextIterResult = thirdIterResult;

      return result;
    }
  };
};

result = Tuple.from(items);

assertEq(result[0], firstIterResult.value);
assertEq(result[1], secondIterResult.value);

reportCompare(0, 0);