test: changed function to arrow function

Convert callback functions that are anonymous
to arrow functions for better readability.
Also adjusted the `this` object in places where
that was required.

PR-URL: https://github.com/nodejs/node/pull/32875
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Nimit
2020-04-16 11:20:39 +05:30
committed by Gireesh Punathil
parent e231e1a0d8
commit 4986286446

View File

@@ -24,14 +24,14 @@ const common = require('../common');
const assert = require('assert');
const net = require('net');
const server = net.createServer(common.mustCall(function(s) {
const server = net.createServer(common.mustCall((s) => {
console.error('SERVER: got connection');
s.end();
}));
server.listen(0, common.mustCall(function() {
const c = net.createConnection(this.address().port);
c.on('close', common.mustCall(function() {
server.listen(0, common.mustCall(() => {
const c = net.createConnection(server.address().port);
c.on('close', common.mustCall(() => {
console.error('connection closed');
assert.strictEqual(c._handle, null);
// Calling functions / accessing properties of a closed socket should not