Skip to content

Commit

Permalink
test: update comments in test-fs-read-offset-null
Browse files Browse the repository at this point in the history
Update comment to refer to the correct ASCII code (120 rather than 66).
All other changes are cosmetic.

PR-URL: #36152
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
Trott authored and codebytere committed Nov 22, 2020
1 parent 48bf59b commit 5fa35f6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/parallel/test-fs-read-offset-null.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ const fixtures = require('../common/fixtures');
const filepath = fixtures.path('x.txt');

const buf = Buffer.alloc(1);
// Reading only one character, hence buffer of one byte is enough
// Reading only one character, hence buffer of one byte is enough.

// Test for callback api
// Test for callback API.
fs.open(filepath, 'r', common.mustSucceed((fd) => {
fs.read(fd, { offset: null, buffer: buf },
common.mustSucceed((bytesRead, buffer) => {
assert.strictEqual(buffer[0], 120);
// Test is done by making sure the first letter in buffer is
// same as first letter in file.
// 66 is the hex for ascii code of letter B

// 120 is the hex for ascii code of letter x.
assert.strictEqual(buffer[0], 120);
fs.close(fd, common.mustSucceed(() => {}));
}));
}));
Expand Down

0 comments on commit 5fa35f6

Please sign in to comment.