diff options
author | 陈健 <chenjian.bzh@bytedance.com> | 2019-04-28 16:46:28 +0800 |
---|---|---|
committer | oyyd <oyydoibh@gmail.com> | 2019-04-30 17:12:14 +0800 |
commit | 9c2774e61379d77ae8768760fa06a631b5dbe19a (patch) | |
tree | b3694ed35f0a89845a708a744d91a8dd36325ace /test | |
parent | 578b31e14b6f80e173c6b90b0a9e60b9a14dfca6 (diff) | |
download | android-node-v8-9c2774e61379d77ae8768760fa06a631b5dbe19a.tar.gz android-node-v8-9c2774e61379d77ae8768760fa06a631b5dbe19a.tar.bz2 android-node-v8-9c2774e61379d77ae8768760fa06a631b5dbe19a.zip |
test: adding mustCall in test-fs-readfile-empty.js
PR-URL: https://github.com/nodejs/node/pull/27455
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-fs-readfile-empty.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/test/parallel/test-fs-readfile-empty.js b/test/parallel/test-fs-readfile-empty.js index 7bb942fc2d..f6303777b2 100644 --- a/test/parallel/test-fs-readfile-empty.js +++ b/test/parallel/test-fs-readfile-empty.js @@ -20,27 +20,26 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -require('../common'); // Trivial test of fs.readFile on an empty file. - -const assert = require('assert'); +const common = require('../common'); const fs = require('fs'); +const assert = require('assert'); const fixtures = require('../common/fixtures'); const fn = fixtures.path('empty.txt'); -fs.readFile(fn, function(err, data) { +fs.readFile(fn, common.mustCall((err, data) => { assert.ok(data); -}); +})); -fs.readFile(fn, 'utf8', function(err, data) { +fs.readFile(fn, 'utf8', common.mustCall((err, data) => { assert.strictEqual(data, ''); -}); +})); -fs.readFile(fn, { encoding: 'utf8' }, function(err, data) { +fs.readFile(fn, { encoding: 'utf8' }, common.mustCall((err, data) => { assert.strictEqual(data, ''); -}); +})); assert.ok(fs.readFileSync(fn)); assert.strictEqual(fs.readFileSync(fn, 'utf8'), ''); |