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: add check to test-fs-readfile-tostring-fail · nodejs/node@bb6787c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/pummel
    • test-fs-readfile-tostring-fail.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/pummel/test-fs-readfile-tostring-fail.js‎

Copy file name to clipboardExpand all lines: test/pummel/test-fs-readfile-tostring-fail.js
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@ stream.on('error', (err) => { throw err; });
2525

2626
const size = kStringMaxLength / 200;
2727
const a = Buffer.alloc(size, 'a');
28+
let expectedSize = 0;
2829

2930
for (let i = 0; i < 201; i++) {
30-
stream.write(a);
31+
stream.write(a, (err) => { assert.ifError(err); });
32+
expectedSize += a.length;
3133
}
3234

3335
stream.end();
3436
stream.on('finish', common.mustCall(function() {
37+
assert.strictEqual(stream.bytesWritten, expectedSize,
38+
`${stream.bytesWritten} bytes written (expected ${expectedSize} bytes).`);
3539
fs.readFile(file, 'utf8', common.mustCall(function(err, buf) {
3640
assert.ok(err instanceof Error);
3741
if (err.message !== 'Array buffer allocation failed') {

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.