wallet-core/node_modules/es6-iterator/test/string.js

24 lines
848 B
JavaScript
Raw Normal View History

2017-12-10 21:51:33 +01:00
"use strict";
2017-08-14 05:01:11 +02:00
2017-12-10 21:51:33 +01:00
var iteratorSymbol = require("es6-symbol").iterator;
2017-08-14 05:01:11 +02:00
module.exports = function (T, a) {
2017-12-10 21:51:33 +01:00
var it = new T("foobar");
2017-08-14 05:01:11 +02:00
a(it[iteratorSymbol](), it, "@@iterator");
2017-12-10 21:51:33 +01:00
a.deep(it.next(), { done: false, value: "f" }, "#1");
a.deep(it.next(), { done: false, value: "o" }, "#2");
a.deep(it.next(), { done: false, value: "o" }, "#3");
a.deep(it.next(), { done: false, value: "b" }, "#4");
a.deep(it.next(), { done: false, value: "a" }, "#5");
a.deep(it.next(), { done: false, value: "r" }, "#6");
2017-08-14 05:01:11 +02:00
a.deep(it.next(), { done: true, value: undefined }, "End");
a.h1("Outside of BMP");
2017-12-10 21:51:33 +01:00
it = new T("r💩z");
a.deep(it.next(), { done: false, value: "r" }, "#1");
a.deep(it.next(), { done: false, value: "💩" }, "#2");
a.deep(it.next(), { done: false, value: "z" }, "#3");
2017-08-14 05:01:11 +02:00
a.deep(it.next(), { done: true, value: undefined }, "End");
};