From d7ca2234dc3057f02ed0728b1c4bae48e4293964 Mon Sep 17 00:00:00 2001 From: MURAKAMI Masahiko Date: Tue, 24 May 2022 08:29:43 +0900 Subject: [PATCH] test: use mustSucceed instead of mustCall with assert.ifError MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/43188 Reviewed-By: Tobias Nießen Reviewed-By: LiviaMedeiros Reviewed-By: Luigi Pinca Reviewed-By: Zeyu "Alex" Yang --- test/parallel/test-fs-options-immutable.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-fs-options-immutable.js b/test/parallel/test-fs-options-immutable.js index b993d776e6e460..77ce3ebf1de9ca 100644 --- a/test/parallel/test-fs-options-immutable.js +++ b/test/parallel/test-fs-options-immutable.js @@ -6,19 +6,17 @@ const common = require('../common'); // // Refer: https://github.com/nodejs/node/issues/7655 -const assert = require('assert'); const fs = require('fs'); const path = require('path'); -const errHandler = (e) => assert.ifError(e); const options = Object.freeze({}); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -fs.readFile(__filename, options, common.mustCall(errHandler)); +fs.readFile(__filename, options, common.mustSucceed()); fs.readFileSync(__filename, options); -fs.readdir(__dirname, options, common.mustCall(errHandler)); +fs.readdir(__dirname, options, common.mustSucceed()); fs.readdirSync(__dirname, options); if (common.canCreateSymLink()) { @@ -28,20 +26,20 @@ if (common.canCreateSymLink()) { fs.writeFileSync(sourceFile, ''); fs.symlinkSync(sourceFile, linkFile); - fs.readlink(linkFile, options, common.mustCall(errHandler)); + fs.readlink(linkFile, options, common.mustSucceed()); fs.readlinkSync(linkFile, options); } { const fileName = path.resolve(tmpdir.path, 'writeFile'); fs.writeFileSync(fileName, 'ABCD', options); - fs.writeFile(fileName, 'ABCD', options, common.mustCall(errHandler)); + fs.writeFile(fileName, 'ABCD', options, common.mustSucceed()); } { const fileName = path.resolve(tmpdir.path, 'appendFile'); fs.appendFileSync(fileName, 'ABCD', options); - fs.appendFile(fileName, 'ABCD', options, common.mustCall(errHandler)); + fs.appendFile(fileName, 'ABCD', options, common.mustSucceed()); } if (!common.isIBMi) { // IBMi does not support fs.watch() @@ -56,13 +54,13 @@ if (!common.isIBMi) { // IBMi does not support fs.watch() { fs.realpathSync(__filename, options); - fs.realpath(__filename, options, common.mustCall(errHandler)); + fs.realpath(__filename, options, common.mustSucceed()); } { const tempFileName = path.resolve(tmpdir.path, 'mkdtemp-'); fs.mkdtempSync(tempFileName, options); - fs.mkdtemp(tempFileName, options, common.mustCall(errHandler)); + fs.mkdtemp(tempFileName, options, common.mustSucceed()); } {