test: add "mustCall" to test-fs-readfile-unlink

Add common.mustCall to test-fs-readfile-unlink

PR-URL: https://github.com/nodejs/node/pull/27453
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
wuchenkai 2019-04-28 16:48:27 +08:00 committed by Weijia Wang
parent 5f6438f625
commit 413256d5e8

View File

@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
require('../common');
const common = require('../common');
// Test that unlink succeeds immediately after readFile completes.
@ -37,7 +37,7 @@ tmpdir.refresh();
fs.writeFileSync(fileName, buf);
fs.readFile(fileName, function(err, data) {
fs.readFile(fileName, common.mustCall((err, data) => {
assert.ifError(err);
assert.strictEqual(data.length, buf.length);
assert.strictEqual(buf[0], 42);
@ -45,4 +45,4 @@ fs.readFile(fileName, function(err, data) {
// Unlink should not throw. This is part of the test. It used to throw on
// Windows due to a bug.
fs.unlinkSync(fileName);
});
}));