summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/from/modify-next.js
blob: d347abd2cd0c19b9ef70609fb05f47ee0d3f3e7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally
const iter = {
  next: () => ({ done: false, value: 0 }),
};

const wrap = Iterator.from(iter);

iter.next = () => ({ done: true, value: undefined });

let {done, value} = wrap.next();
assertEq(done, false);
assertEq(value, 0);

if (typeof reportCompare === 'function')
  reportCompare(0, 0);