-
Notifications
You must be signed in to change notification settings - Fork 516
Open
Description
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
nullorundefined - Coerces the iterator contents to string, except
nullandundefined -
nullandundefinedfrom 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
nullfrom itsnext, the iterator does not get closed - If the iterator is exhausted, the iterator does not get closed
-
.nextis looked up only after ToString'ing the separator
Metadata
Metadata
Assignees
Labels
No labels