test: replace closure with arrow functions

PR-URL: https://github.com/nodejs/node/pull/24438
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Amanpreet 2018-11-17 18:14:58 +05:30 committed by Gireesh Punathil
parent f63dc27eec
commit 6b91c36103

View File

@ -46,17 +46,17 @@ function test1() {
r._read = function(n) {
switch (reads--) {
case 5:
return setImmediate(function() {
return setImmediate(() => {
return r.push(buf);
});
case 4:
setImmediate(function() {
setImmediate(() => {
return r.push(Buffer.alloc(0));
});
return setImmediate(r.read.bind(r, 0));
case 3:
setImmediate(r.read.bind(r, 0));
return process.nextTick(function() {
return process.nextTick(() => {
return r.push(Buffer.alloc(0));
});
case 2:
@ -78,12 +78,12 @@ function test1() {
results.push(String(chunk));
}
r.on('readable', flow);
r.on('end', function() {
r.on('end', () => {
results.push('EOF');
});
flow();
process.on('exit', function() {
process.on('exit', () => {
assert.deepStrictEqual(results, [ 'xxxxx', 'xxxxx', 'EOF' ]);
console.log('ok');
});
@ -106,12 +106,12 @@ function test2() {
results.push(String(chunk));
}
r.on('readable', flow);
r.on('end', function() {
r.on('end', () => {
results.push('EOF');
});
flow();
process.on('exit', function() {
process.on('exit', () => {
assert.deepStrictEqual(results, [ 'eHh4', 'eHg=', 'EOF' ]);
console.log('ok');
});