3 var ee = require('event-emitter')
4 , iteratorSymbol = require('es6-symbol').iterator;
6 module.exports = function (T) {
9 var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć'], it, y, z;
12 a(it[iteratorSymbol](), it, "@@iterator");
14 a.deep(y, { done: false, value: 'raz' }, "#1");
16 a.not(y, z, "Recreate result");
17 a.deep(z, { done: false, value: 'dwa' }, "#2");
18 a.deep(it.next(), { done: false, value: 'trzy' }, "#3");
19 a.deep(it.next(), { done: false, value: 'cztery' }, "#4");
20 a.deep(it.next(), { done: false, value: 'pięć' }, "#5");
21 a.deep(y = it.next(), { done: true, value: undefined }, "End");
22 a.not(y, it.next(), "Recreate result on dead");
24 Emited: function (a) {
25 var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć'], y, it;
29 a.deep(it.next(), { done: false, value: 'raz' }, "#1");
30 a.deep(it.next(), { done: false, value: 'dwa' }, "#2");
31 y.emit('_add', x.push('sześć') - 1);
32 a.deep(it.next(), { done: false, value: 'trzy' }, "#3");
33 x.splice(1, 0, 'półtora');
35 a.deep(it.next(), { done: false, value: 'półtora' }, "Insert");
38 a.deep(it.next(), { done: false, value: 'cztery' }, "#4");
39 a.deep(it.next(), { done: false, value: 'sześć' }, "#5");
40 a.deep(it.next(), { done: true, value: undefined }, "End");
42 "Emited #2": function (a) {
43 var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], y, it;
47 a.deep(it.next(), { done: false, value: 'raz' }, "#1");
48 a.deep(it.next(), { done: false, value: 'dwa' }, "#2");
49 x.splice(1, 0, 'półtora');
51 x.splice(1, 0, '1.25');
55 a.deep(it.next(), { done: false, value: 'półtora' }, "Insert");
56 a.deep(it.next(), { done: false, value: '1.25' }, "Insert #2");
57 a.deep(it.next(), { done: false, value: 'trzy' }, "#3");
58 a.deep(it.next(), { done: false, value: 'cztery' }, "#4");
61 a.deep(it.next(), { done: false, value: 'sześć' }, "#5");
62 a.deep(it.next(), { done: true, value: undefined }, "End");
64 "Emited: Clear #1": function (a) {
65 var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], y, it;
69 a.deep(it.next(), { done: false, value: 'raz' }, "#1");
70 a.deep(it.next(), { done: false, value: 'dwa' }, "#2");
73 a.deep(it.next(), { done: true, value: undefined }, "End");
75 "Emited: Clear #2": function (a) {
76 var x = ['raz', 'dwa', 'trzy', 'cztery', 'pięć', 'sześć'], y, it;
80 a.deep(it.next(), { done: false, value: 'raz' }, "#1");
81 a.deep(it.next(), { done: false, value: 'dwa' }, "#2");
86 a.deep(it.next(), { done: false, value: 'foo' }, "#3");
87 a.deep(it.next(), { done: false, value: 'bar' }, "#4");
88 x.splice(1, 0, 'półtora');
90 x.splice(1, 0, '1.25');
94 a.deep(it.next(), { done: false, value: 'półtora' }, "Insert");
95 a.deep(it.next(), { done: false, value: '1.25' }, "Insert #2");
96 a.deep(it.next(), { done: true, value: undefined }, "End");