Bladeren bron

Rearranged manual tests used in development.

Eugene Lazutkin 3 jaren geleden
bovenliggende
commit
a3a50afba8
3 gewijzigde bestanden met toevoegingen van 27 en 27 verwijderingen
  1. 27 0
      tests/manual/asStreamTest.js
  2. 0 0
      tests/manual/streamEventsTest.js
  3. 0 27
      y.js

+ 27 - 0
tests/manual/asStreamTest.js

@@ -0,0 +1,27 @@
+
+const {PassThrough} = require('stream');
+
+const defs = require('../../src/defs');
+const asStream = require('../../src/AsStream');
+
+const s = asStream(x => x * x);
+// const s = asStream(async x => x * x);
+// const s = asStream(function* (x) { for (let i = 0; i < x; ++i) yield i; });
+// const s = asStream(async function* (x) { for (let i = 0; i < x; ++i) yield i; });
+
+// const s = asStream(x => defs.none);
+// const s = asStream(x => defs.finalValue(42));
+// const s = asStream(x => defs.many(['a', x, 'b']));
+// const s = asStream(x => defs.stop);
+
+const h = new PassThrough({writableObjectMode: true, readableObjectMode: true});
+const p = h.pipe(s);
+
+p.on('data', data => console.log('DATA:', data));
+p.on('end', () => console.log('END'));
+
+h.write(1);
+h.write(2);
+h.write(3);
+h.write(4);
+h.end();

z.js → tests/manual/streamEventsTest.js


+ 0 - 27
y.js

@@ -1,27 +0,0 @@
-
-const {PassThrough} = require('stream');
-
-const defs = require('./defs');
-const {make: makeStream} = require('./src/AsStream');
-
-const s = makeStream(x => x * x);
-// const s = makeStream(async x => x * x);
-// const s = makeStream(function* (x) { for (let i = 0; i < x; ++i) yield i; });
-// const s = makeStream(async function* (x) { for (let i = 0; i < x; ++i) yield i; });
-
-// const s = makeStream(x => defs.none);
-// const s = makeStream(x => defs.finalValue(42));
-// const s = makeStream(x => defs.many(['a', x, 'b']));
-// const s = makeStream(x => defs.stop);
-
-const h = new PassThrough({writableObjectMode: true, readableObjectMode: true});
-const p = h.pipe(s);
-
-p.on('data', data => console.log('DATA:', data));
-p.on('end', () => console.log('END'));
-
-h.write(1);
-h.write(2);
-h.write(3);
-h.write(4);
-h.end();