diff options
author | cjihrig <cjihrig@gmail.com> | 2016-12-30 10:54:01 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2017-01-02 09:48:52 -0500 |
commit | 746a46ebddf594370137042b9b3a0af80daff903 (patch) | |
tree | 3defd7922c80a984bd0422cf6bdcf4ab3dd81aa1 /test/parallel/test-fs-write.js | |
parent | 152bd82de9b49e0497a2fe267c1d04207d837f40 (diff) | |
download | node-new-746a46ebddf594370137042b9b3a0af80daff903.tar.gz |
test: increase usage of assert.ifError()
PR-URL: https://github.com/nodejs/node/pull/10543
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-write.js')
-rw-r--r-- | test/parallel/test-fs-write.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js index 9960a91a4f..81f5cf707b 100644 --- a/test/parallel/test-fs-write.js +++ b/test/parallel/test-fs-write.js @@ -12,14 +12,14 @@ const constants = fs.constants; common.refreshTmpDir(); fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) { - if (err) throw err; + assert.ifError(err); console.log('open done'); fs.write(fd, '', 0, 'utf8', function(err, written) { assert.strictEqual(0, written); }); fs.write(fd, expected, 0, 'utf8', common.mustCall(function(err, written) { console.log('write done'); - if (err) throw err; + assert.ifError(err); assert.strictEqual(Buffer.byteLength(expected), written); fs.closeSync(fd); const found = fs.readFileSync(fn, 'utf8'); @@ -33,14 +33,14 @@ fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) { fs.open(fn2, constants.O_CREAT | constants.O_WRONLY | constants.O_TRUNC, 0o644, common.mustCall((err, fd) => { - if (err) throw err; + assert.ifError(err); console.log('open done'); fs.write(fd, '', 0, 'utf8', (err, written) => { assert.strictEqual(0, written); }); fs.write(fd, expected, 0, 'utf8', common.mustCall((err, written) => { console.log('write done'); - if (err) throw err; + assert.ifError(err); assert.strictEqual(Buffer.byteLength(expected), written); fs.closeSync(fd); const found = fs.readFileSync(fn2, 'utf8'); |