js/src/jit-test/tests/for-of/next-arity.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/for-of/next-arity.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,22 @@
     1.4 +// For-of passes one arg to "next".
     1.5 +
     1.6 +load(libdir + 'iteration.js')
     1.7 +
     1.8 +var log = '';
     1.9 +
    1.10 +function Iter() {
    1.11 +    function next() {
    1.12 +        log += 'n';
    1.13 +        assertEq(arguments.length, 1)
    1.14 +        assertEq(arguments[0], undefined)
    1.15 +        return { get value() { throw 42; }, done: true }
    1.16 +    }
    1.17 +
    1.18 +    this[std_iterator] = function () { return this; }
    1.19 +    this.next = next;
    1.20 +}
    1.21 +
    1.22 +for (var x of new Iter())
    1.23 +    throw 'not reached';
    1.24 +
    1.25 +assertEq(log, 'n');

mercurial