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:
parent
f63dc27eec
commit
6b91c36103
@ -46,17 +46,17 @@ function test1() {
|
|||||||
r._read = function(n) {
|
r._read = function(n) {
|
||||||
switch (reads--) {
|
switch (reads--) {
|
||||||
case 5:
|
case 5:
|
||||||
return setImmediate(function() {
|
return setImmediate(() => {
|
||||||
return r.push(buf);
|
return r.push(buf);
|
||||||
});
|
});
|
||||||
case 4:
|
case 4:
|
||||||
setImmediate(function() {
|
setImmediate(() => {
|
||||||
return r.push(Buffer.alloc(0));
|
return r.push(Buffer.alloc(0));
|
||||||
});
|
});
|
||||||
return setImmediate(r.read.bind(r, 0));
|
return setImmediate(r.read.bind(r, 0));
|
||||||
case 3:
|
case 3:
|
||||||
setImmediate(r.read.bind(r, 0));
|
setImmediate(r.read.bind(r, 0));
|
||||||
return process.nextTick(function() {
|
return process.nextTick(() => {
|
||||||
return r.push(Buffer.alloc(0));
|
return r.push(Buffer.alloc(0));
|
||||||
});
|
});
|
||||||
case 2:
|
case 2:
|
||||||
@ -78,12 +78,12 @@ function test1() {
|
|||||||
results.push(String(chunk));
|
results.push(String(chunk));
|
||||||
}
|
}
|
||||||
r.on('readable', flow);
|
r.on('readable', flow);
|
||||||
r.on('end', function() {
|
r.on('end', () => {
|
||||||
results.push('EOF');
|
results.push('EOF');
|
||||||
});
|
});
|
||||||
flow();
|
flow();
|
||||||
|
|
||||||
process.on('exit', function() {
|
process.on('exit', () => {
|
||||||
assert.deepStrictEqual(results, [ 'xxxxx', 'xxxxx', 'EOF' ]);
|
assert.deepStrictEqual(results, [ 'xxxxx', 'xxxxx', 'EOF' ]);
|
||||||
console.log('ok');
|
console.log('ok');
|
||||||
});
|
});
|
||||||
@ -106,12 +106,12 @@ function test2() {
|
|||||||
results.push(String(chunk));
|
results.push(String(chunk));
|
||||||
}
|
}
|
||||||
r.on('readable', flow);
|
r.on('readable', flow);
|
||||||
r.on('end', function() {
|
r.on('end', () => {
|
||||||
results.push('EOF');
|
results.push('EOF');
|
||||||
});
|
});
|
||||||
flow();
|
flow();
|
||||||
|
|
||||||
process.on('exit', function() {
|
process.on('exit', () => {
|
||||||
assert.deepStrictEqual(results, [ 'eHh4', 'eHg=', 'EOF' ]);
|
assert.deepStrictEqual(results, [ 'eHh4', 'eHg=', 'EOF' ]);
|
||||||
console.log('ok');
|
console.log('ok');
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user