test: replace anonymous closure functions with arrow functions

In `test/parallel/test-fs-truncate-fd.js`, callbacks use anonymous
closure functions. It is safe to replace them with arrow functions since
these callbacks don't alter their context (`this`). This results in
shorter functions.

PR-URL: https://github.com/nodejs/node/pull/24478
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
sagirk 2018-11-19 11:56:32 +05:30 committed by Rich Trott
parent 62fe4165f0
commit dcaa1a03f7

View File

@ -16,12 +16,12 @@ const msg = 'Using fs.truncate with a file descriptor is deprecated.' +
common.expectWarning('DeprecationWarning', msg, 'DEP0081');
fs.truncate(fd, 5, common.mustCall(function(err) {
fs.truncate(fd, 5, common.mustCall((err) => {
assert.ok(!err);
assert.strictEqual(fs.readFileSync(filename, 'utf8'), 'hello');
}));
process.on('exit', function() {
process.on('exit', () => {
fs.closeSync(fd);
fs.unlinkSync(filename);
console.log('ok');