diff --git a/package.json b/package.json index f049e38..6e6ea5a 100644 --- a/package.json +++ b/package.json @@ -155,6 +155,7 @@ "has-strict-mode": "^1.0.1", "in-publish": "^2.0.1", "iterate-iterator": "^1.0.2", + "make-generator-function": "^2.0.0", "mock-property": "^1.0.0", "npmignore": "^0.3.0", "nyc": "^10.3.2", diff --git a/test/Iterator.prototype.map.js b/test/Iterator.prototype.map.js index 471141a..19ca32b 100644 --- a/test/Iterator.prototype.map.js +++ b/test/Iterator.prototype.map.js @@ -9,6 +9,7 @@ var forEach = require('for-each'); var debug = require('object-inspect'); var v = require('es-value-fixtures'); var hasSymbols = require('has-symbols/shams')(); +var generators = require('make-generator-function')(); var index = require('../Iterator.prototype.map'); var impl = require('../Iterator.prototype.map/implementation'); @@ -102,6 +103,17 @@ module.exports = { testIterator(map(iterator(), function (x) { return x; }), [1, 2, 3], st, 'identity mapper'); testIterator(map(iterator(), function (x) { return 2 * x; }), [2, 4, 6], st, 'doubler mapper'); + st.test('generators', { skip: generators.length === 0 }, function (s2t) { + forEach(generators, function (gen) { + s2t.doesNotThrow( + function () { map(gen(), function () {}); }, + 'generator function ' + debug(gen) + ' does not need to be from-wrapped first' + ); + }); + + s2t.end(); + }); + st.end(); }); },