Skip to content

Commit 6f3fb46

Browse files
lpincaMylesBorins
authored andcommitted
test: use correct size in test-stream-buffer-list
The `n` argument of `BufferList.prototype.concat()` is not the number of `Buffer` instances in the list, but their total length when concatenated. PR-URL: #18239 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 37e594e commit 6f3fb46

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/parallel/test-stream-buffer-list.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,19 @@ assert.strictEqual(emptyList.join(','), '');
1414

1515
assert.deepStrictEqual(emptyList.concat(0), Buffer.alloc(0));
1616

17+
const buf = Buffer.from('foo');
18+
1719
// Test buffer list with one element.
1820
const list = new BufferList();
19-
list.push('foo');
21+
list.push(buf);
22+
23+
const copy = list.concat(3);
2024

21-
assert.strictEqual(list.concat(1), 'foo');
25+
assert.notStrictEqual(copy, buf);
26+
assert.deepStrictEqual(copy, buf);
2227

2328
assert.strictEqual(list.join(','), 'foo');
2429

2530
const shifted = list.shift();
26-
assert.strictEqual(shifted, 'foo');
31+
assert.strictEqual(shifted, buf);
2732
assert.deepStrictEqual(list, new BufferList());

0 commit comments

Comments
 (0)