GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: `buffer.write` with longer string scenario · nodejs/node@914eddd

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-buffer-write.js
Expand file treeCollapse file tree
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)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.