Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 08edf53

Browse filesBrowse files
HarshithaKPMylesBorins
authored andcommitted
test: buffer.write with longer string scenario
Make sure longer strings are written up to the buffer end Refs: #32119 PR-URL: #32123 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent d497f26 commit 08edf53
Copy full SHA for 08edf53

File tree

Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-buffer-write.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-buffer-write.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ 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);
95+
assert.deepStrictEqual([...z], [0, 0, 0x61, 0x62]);
9396

9497
// Large overrun could corrupt the process
9598
assert.strictEqual(Buffer.alloc(4)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.