get.js 600 B

12345678910111213141516
  1. 'use strict';
  2. var iteratorSymbol = require('es6-symbol').iterator
  3. , Iterator = require('../');
  4. module.exports = function (t, a) {
  5. var iterator;
  6. a.throws(function () { t(); }, TypeError, "Null");
  7. a.throws(function () { t({}); }, TypeError, "Plain object");
  8. a.throws(function () { t({ length: 0 }); }, TypeError, "Array-like");
  9. iterator = {};
  10. iterator[iteratorSymbol] = function () { return new Iterator([]); };
  11. a(t(iterator) instanceof Iterator, true, "Iterator");
  12. a(String(t([])), '[object Array Iterator]', " Array");
  13. a(String(t('foo')), '[object String Iterator]', "String");
  14. };