Skip to content

Commit

Permalink
test: replace anonymous closure functions with arrow functions
Browse files Browse the repository at this point in the history
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: #24478
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
sagirk authored and rvagg committed Nov 28, 2018
1 parent fbb228b commit f19dae3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/parallel/test-fs-truncate-fd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit f19dae3

Please sign in to comment.