aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-stream2-readable-from-list.js
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2017-06-15 18:03:37 -0400
committercjihrig <cjihrig@gmail.com>2017-06-19 16:04:00 -0400
commitd3c668cead3d5baff03d795755e2ae1906408580 (patch)
tree84c2c3d160046f2e9bda9628f42825260cdd665f /test/parallel/test-stream2-readable-from-list.js
parent471e88feb47e8a711e395cf6167d723adf3d1b7a (diff)
downloadandroid-node-v8-d3c668cead3d5baff03d795755e2ae1906408580.tar.gz
android-node-v8-d3c668cead3d5baff03d795755e2ae1906408580.tar.bz2
android-node-v8-d3c668cead3d5baff03d795755e2ae1906408580.zip
test: remove node-tap lookalike
This commit removes the small node-tap lookalike from several of the streams2 tests. It's only used by six tests, and is inconsistent with all other tests. PR-URL: https://github.com/nodejs/node/pull/13707 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-stream2-readable-from-list.js')
-rw-r--r--test/parallel/test-stream2-readable-from-list.js69
1 files changed, 16 insertions, 53 deletions
diff --git a/test/parallel/test-stream2-readable-from-list.js b/test/parallel/test-stream2-readable-from-list.js
index 6f677ce8a4..965f962638 100644
--- a/test/parallel/test-stream2-readable-from-list.js
+++ b/test/parallel/test-stream2-readable-from-list.js
@@ -26,33 +26,6 @@ const assert = require('assert');
const fromList = require('_stream_readable')._fromList;
const BufferList = require('internal/streams/BufferList');
-// tiny node-tap lookalike.
-const tests = [];
-let count = 0;
-
-function test(name, fn) {
- count++;
- tests.push([name, fn]);
-}
-
-function run() {
- const next = tests.shift();
- if (!next)
- return console.error('ok');
-
- const name = next[0];
- const fn = next[1];
- console.log('# %s', name);
- fn({
- same: assert.deepStrictEqual,
- equal: assert.strictEqual,
- end: function() {
- count--;
- run();
- }
- });
-}
-
function bufferListFromArray(arr) {
const bl = new BufferList();
for (let i = 0; i < arr.length; ++i)
@@ -60,15 +33,8 @@ function bufferListFromArray(arr) {
return bl;
}
-// ensure all tests have run
-process.on('exit', function() {
- assert.strictEqual(count, 0);
-});
-
-process.nextTick(run);
-
-
-test('buffers', function(t) {
+{
+ // Verify behavior with buffers
let list = [ Buffer.from('foog'),
Buffer.from('bark'),
Buffer.from('bazy'),
@@ -77,27 +43,26 @@ test('buffers', function(t) {
// read more than the first element.
let ret = fromList(6, { buffer: list, length: 16 });
- t.equal(ret.toString(), 'foogba');
+ assert.strictEqual(ret.toString(), 'foogba');
// read exactly the first element.
ret = fromList(2, { buffer: list, length: 10 });
- t.equal(ret.toString(), 'rk');
+ assert.strictEqual(ret.toString(), 'rk');
// read less than the first element.
ret = fromList(2, { buffer: list, length: 8 });
- t.equal(ret.toString(), 'ba');
+ assert.strictEqual(ret.toString(), 'ba');
// read more than we have.
ret = fromList(100, { buffer: list, length: 6 });
- t.equal(ret.toString(), 'zykuel');
+ assert.strictEqual(ret.toString(), 'zykuel');
// all consumed.
- t.same(list, new BufferList());
-
- t.end();
-});
+ assert.deepStrictEqual(list, new BufferList());
+}
-test('strings', function(t) {
+{
+ // Verify behavior with strings
let list = [ 'foog',
'bark',
'bazy',
@@ -106,22 +71,20 @@ test('strings', function(t) {
// read more than the first element.
let ret = fromList(6, { buffer: list, length: 16, decoder: true });
- t.equal(ret, 'foogba');
+ assert.strictEqual(ret, 'foogba');
// read exactly the first element.
ret = fromList(2, { buffer: list, length: 10, decoder: true });
- t.equal(ret, 'rk');
+ assert.strictEqual(ret, 'rk');
// read less than the first element.
ret = fromList(2, { buffer: list, length: 8, decoder: true });
- t.equal(ret, 'ba');
+ assert.strictEqual(ret, 'ba');
// read more than we have.
ret = fromList(100, { buffer: list, length: 6, decoder: true });
- t.equal(ret, 'zykuel');
+ assert.strictEqual(ret, 'zykuel');
// all consumed.
- t.same(list, new BufferList());
-
- t.end();
-});
+ assert.deepStrictEqual(list, new BufferList());
+}