blob: 4045801277b037d444e2b61609f7572c592105e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// |reftest| skip-if(!this.hasOwnProperty('Iterator')) -- Iterator is not enabled unconditionally
/*---
Iterator.from returns an iterator wrapper if O is not an instance of Iterator.
---*/
class TestIterator {
[Symbol.iterator]() {
return this;
}
next() {
return { done: false, value: 0 };
}
}
const iter = new TestIterator();
assertEq(iter instanceof Iterator, false);
const wrapper = Iterator.from(iter);
assertEq(iter !== wrapper, true);
assertEq(wrapper instanceof Iterator, true);
if (typeof reportCompare === 'function')
reportCompare(0, 0);
|