summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Iterator/from/call-from-with-different-this.js
blob: 7016f7759bc6b9e0eb4d48537f3ff02e71e152cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally
const iter = {
  next() {
    assertEq(arguments.length, 0);
    return {done: false, value: 0};
  },
};
const wrap = Iterator.from.call(undefined, iter);

const result = wrap.next("next argument is ignored");
assertEq(result.done, false);
assertEq(result.value, 0);

const returnResult = wrap.return("return argument is ignored");
assertEq(returnResult.done, true);
assertEq(returnResult.value, undefined);

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