summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Tuple/from/iter-map-fn-this-non-strict.js
blob: 56225e0021e64cc9ffc6bc09b9cf51e57af86a5e (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
38
39
// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
var thisVals = [];
var nextResult = {
  done: false,
  value: {}
};
var nextNextResult = {
  done: false,
  value: {}
};
var mapFn = function() {
  thisVals.push(this);
};
var items = {};
var global = function() {
  return this;
}();

items[Symbol.iterator] = function() {
  return {
    next: function() {
      var result = nextResult;
      nextResult = nextNextResult;
      nextNextResult = {
        done: true
      };

      return result;
    }
  };
};

Tuple.from(items, mapFn);

assertEq(thisVals.length, 2);
assertEq(thisVals[0], global);
assertEq(thisVals[1], global);

reportCompare(0, 0);