The iterator join proposal is at stage 2.7 (not to be confused with the joint iteration proposal , newly at stage 3).
I came up with this list of tests by thinking about it, and then looking at the tests for Array.prototype.join .
The usual boilerplate around name / length / enumerability / etc
Expected results when joining iterator length 0, 1, 2, 3 with no provided separator
As above but with a nonempty string as separator
As above but with empty string as separator
Throws if the receiver is not an object
Coerces the separator argument to string, including null or undefined
Coerces the iterator contents to string, except null and undefined
null and undefined from the iterator produce empty strings in the result
If ToString'ing the separator throws, the iterator gets closed
If ToString'ing a value from the iterator throws, the iterator gets closed
If the iterator throws, the iterator does not get closed
If the iterator otherwise violates the iterator protocol, e.g. by returning null from its next, the iterator does not get closed
If the iterator is exhausted, the iterator does not get closed
.next is looked up only after ToString'ing the separator
The iterator join proposal is at stage 2.7 (not to be confused with the joint iteration proposal, newly at stage 3).
I came up with this list of tests by thinking about it, and then looking at the tests for Array.prototype.join.
nullorundefinednullandundefinednullandundefinedfrom the iterator produce empty strings in the resultnullfrom itsnext, the iterator does not get closed.nextis looked up only after ToString'ing the separator