Skip to content

Commit 2313424

Browse files
committed
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 <[email protected]>
1 parent 80b3acc commit 2313424

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
@@ -15,16 +15,21 @@ assert.strictEqual(emptyList.join(','), '');
1515

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

18+
const buf = Buffer.from('foo');
19+
1820
// Test buffer list with one element.
1921
const list = new BufferList();
20-
list.push('foo');
22+
list.push(buf);
23+
24+
const copy = list.concat(3);
2125

22-
assert.strictEqual(list.concat(1), 'foo');
26+
assert.notStrictEqual(copy, buf);
27+
assert.deepStrictEqual(copy, buf);
2328

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

2631
const shifted = list.shift();
27-
assert.strictEqual(shifted, 'foo');
32+
assert.strictEqual(shifted, buf);
2833
assert.deepStrictEqual(list, new BufferList());
2934

3035
const tmp = util.inspect.defaultOptions.colors;

0 commit comments

Comments
 (0)