Skip to content

Commit

Permalink
test: replace closure with arrow functions
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
Amanpreet-03 authored and codebytere committed Jan 29, 2019
1 parent 380da04 commit 94d200f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/parallel/test-stream2-readable-empty-buffer-no-eof.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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');
});
Expand All @@ -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');
});
Expand Down

0 comments on commit 94d200f

Please sign in to comment.