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.
  • Loading branch information
shisama committed Sep 30, 2018
1 parent aba7677 commit 3bf28b1
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 3bf28b1

Please sign in to comment.