Skip to content

Commit

Permalink
test: error when empty buffer is passed to fs.read()
Browse files Browse the repository at this point in the history
Added tests to occur error when empty buffer is passed to fs.read()
to increase coverage.

PR-URL: #23141
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
shisama authored and jasnell committed Oct 17, 2018
1 parent 59feb53 commit a29631b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/parallel/test-fs-read-empty-buffer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';
require('../common');
const common = require('../common');
const fixtures = require('../common/fixtures');
const assert = require('assert');
const fs = require('fs');
Expand All @@ -16,3 +17,12 @@ assert.throws(
'Received Uint8Array []'
}
);

assert.throws(
() => fs.read(fd, buffer, 0, 1, 0, common.mustNotCall()),
{
code: 'ERR_INVALID_ARG_VALUE',
message: 'The argument \'buffer\' is empty and cannot be written. ' +
'Received Uint8Array []'
}
);

0 comments on commit a29631b

Please sign in to comment.