summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Tuple/from/iter-next-value-error.js
blob: e3b78f0c60714d68172d43ed12c4c72a448d0116 (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"))
/* Step 6b. */
/* AddEntriesFromIterable should throw if next() throws */

var iter = {};
iter[Symbol.iterator] = function() {
  return {
    next: function() {
      var result = {};
      Object.defineProperty(result, 'value', {
        get: function() {
          throw new SyntaxError();
        }
      });

      return result;
    }
  };
};

assertThrowsInstanceOf(function() {
  Tuple.from(iter);
}, SyntaxError, "from() should throw if next() returns value that throws");

reportCompare(0, 0);