|
1 | 1 | import { createIterable, createIterator } from '../helpers/helpers.js';
|
2 | 2 |
|
3 | 3 | import concat from 'core-js-pure/full/iterator/concat';
|
4 |
| -import Iterator from 'core-js-pure/full/iterator'; |
| 4 | +import Iterator from 'core-js-pure/es/iterator'; |
| 5 | +import Symbol from 'core-js-pure/es/symbol'; |
5 | 6 | import from from 'core-js-pure/es/array/from';
|
6 | 7 |
|
7 | 8 | QUnit.test('Iterator.concat', assert => {
|
@@ -60,6 +61,27 @@ QUnit.test('Iterator.concat', assert => {
|
60 | 61 | assert.deepEqual(iterator.return(), { done: true, value: undefined }, '.return with active inner iterator with return result');
|
61 | 62 | assert.true(called, 'inner .return called');
|
62 | 63 |
|
| 64 | + // https://github.com/tc39/proposal-iterator-sequencing/issues/17 |
| 65 | + const oldIterResult = { |
| 66 | + done: false, |
| 67 | + value: 123, |
| 68 | + }; |
| 69 | + const testIterator = { |
| 70 | + next() { |
| 71 | + return oldIterResult; |
| 72 | + }, |
| 73 | + }; |
| 74 | + const iterable = { |
| 75 | + [Symbol.iterator]() { |
| 76 | + return testIterator; |
| 77 | + }, |
| 78 | + }; |
| 79 | + iterator = concat(iterable); |
| 80 | + const iterResult = iterator.next(); |
| 81 | + assert.same(iterResult.done, false); |
| 82 | + assert.same(iterResult.value, 123); |
| 83 | + assert.same(iterResult, oldIterResult); |
| 84 | + |
63 | 85 | assert.throws(() => concat(createIterator([1, 2, 3])), TypeError, 'non-iterable iterator #1');
|
64 | 86 | assert.throws(() => concat([], createIterator([1, 2, 3])), TypeError, 'non-iterable iterator #2');
|
65 | 87 | assert.throws(() => concat(''), TypeError, 'iterable non-object argument #1');
|
|
0 commit comments