Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Co-authored-by: Ms2ger <Ms2ger@igalia.com>
  • Loading branch information
michaelficarra and Ms2ger authored Jul 13, 2023
1 parent 20e4420 commit 550c111
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/built-ins/Iterator/from/iterable-primitives.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,17 @@ assert.throws(TypeError, function () {
assert.compareArray(Array.from(Iterator.from(new Number(5))), [0, 1, 2, 3, 4]);

assert.compareArray(Array.from(Iterator.from('string')), ['s', 't', 'r', 'i', 'n', 'g']);

const originalStringIterator = String.prototype[Symbol.iterator];
let observedType;
Object.defineProperty(String.prototype, Symbol.iterator, {
get() {
'use strict';
observedType = typeof this;
return originalStringIterator;
}
});
Iterator.from('');
assert.sameValue(observedType, 'string');
Iterator.from(new String(''));
assert.sameValue(observedType, 'object');
1 change: 1 addition & 0 deletions test/built-ins/Iterator/from/supports-iterable.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ features: [iterator-helpers]
flags: []
---*/
assert.compareArray(Array.from(Iterator.from([0, 1, 2, 3])), [0, 1, 2, 3]);
assert.compareArray(Array.from(Iterator.from(new String('str'))), ['s', 't', 'r']);

0 comments on commit 550c111

Please sign in to comment.