mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
test: increase buffer list coverage
1. test consuming BufferList which has strings with > 1 items Refs: https://coverage.nodejs.org/coverage-0b6d3070a176d437/lib/internal/streams/buffer_list.js.html#L116 2. test consuming BufferList with > 1 items Refs: https://coverage.nodejs.org/coverage-0b6d3070a176d437/lib/internal/streams/buffer_list.js.html#L152 PR-URL: https://github.com/nodejs/node/pull/36688 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
cb2535ef7f
commit
0aef78e4d0
1 file changed
+34
@@ -48,3 +48,37 @@ const shifted = list.shift();
|
||||
testIterator(list, 0);
|
||||
assert.strictEqual(shifted, buf);
|
||||
assert.deepStrictEqual(list, new BufferList());
|
||||
|
||||
{
|
||||
const list = new BufferList();
|
||||
list.push('foo');
|
||||
list.push('bar');
|
||||
list.push('foo');
|
||||
list.push('bar');
|
||||
assert.strictEqual(list.consume(6, true), 'foobar');
|
||||
assert.strictEqual(list.consume(6, true), 'foobar');
|
||||
}
|
||||
|
||||
{
|
||||
const list = new BufferList();
|
||||
list.push('foo');
|
||||
list.push('bar');
|
||||
assert.strictEqual(list.consume(5, true), 'fooba');
|
||||
}
|
||||
|
||||
{
|
||||
const list = new BufferList();
|
||||
list.push(buf);
|
||||
list.push(buf);
|
||||
list.push(buf);
|
||||
list.push(buf);
|
||||
assert.strictEqual(list.consume(6).toString(), 'foofoo');
|
||||
assert.strictEqual(list.consume(6).toString(), 'foofoo');
|
||||
}
|
||||
|
||||
{
|
||||
const list = new BufferList();
|
||||
list.push(buf);
|
||||
list.push(buf);
|
||||
assert.strictEqual(list.consume(5).toString(), 'foofo');
|
||||
}
|
||||
Reference in new issue
Block a user