Skip to content

Commit 2fdbb5e

Browse files
committed
test: buffer.write with longer string scenario
Make sure longer strings are written up to the buffer end Refs: nodejs#32119
1 parent 757e203 commit 2fdbb5e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

test/parallel/test-buffer-write.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ for (let i = 1; i < 4; i++) {
9090
const z = Buffer.alloc(4, 0);
9191
assert.strictEqual(z.write('\u0001', 3, 'ucs2'), 0);
9292
assert.strictEqual(Buffer.compare(z, Buffer.alloc(4, 0)), 0);
93+
// Make sure longer strings are written up to the buffer end.
94+
assert.strictEqual(z.write('abcd', 2), 2);
9395

9496
// Large overrun could corrupt the process
9597
assert.strictEqual(Buffer.alloc(4)

0 commit comments

Comments
 (0)