Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/yield/iter-value-unspecified.js

raw
1 // Copyright (C) 2013 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 25.2
5 description: >
6 When the `next` method of a generator-produced iterable is invoked without
7 an argument, the corresponding `yield` expression should be evaluated as
8 `undefined`.
9 features: [generators]
10 ---*/
11
12 function* g() { actual = yield; }
13 var iter = g();
14 var actual, result;
15
16 result = iter.next();
17 assert.sameValue(result.value, undefined);
18 assert.sameValue(result.done, false);
19 assert.sameValue(actual, undefined);
20
21 result = iter.next();
22 assert.sameValue(result.value, undefined);
23 assert.sameValue(result.done, true);
24 assert.sameValue(actual, undefined);