summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Tuple/from/source-object-iterator-1.js
blob: 65afd950f4da92f82d55d47e6e12e7c0e80c3b10 (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
// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
var array = [2, 4, 8, 16, 32, 64, 128];
var obj = {
  [Symbol.iterator]() {
    return {
      index: 0,
      next() {
        throw new RangeError();
      },
      isDone: false,
      get val() {
        this.index++;
        if (this.index > 7) {
          this.isDone = true;
        }
        return 1 << this.index;
      }
    };
  }
};
assertThrowsInstanceOf(function() {
  Tuple.from(obj);
}, RangeError, 'Tuple.from(obj) throws');

reportCompare(0, 0);