test: replace function with arrow function

PR-URL: https://github.com/nodejs/node/pull/17308
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Hiroaki KARASAWA 2017-11-26 17:34:16 +09:00 committed by James M Snell
parent 54ff3b6b05
commit bd9f7d5994

View File

@ -54,12 +54,12 @@ const inputs = [
const timeouts = []; const timeouts = [];
const intervals = []; const intervals = [];
inputs.forEach(function(value, index) { inputs.forEach((value, index) => {
setTimeout(function() { setTimeout(() => {
timeouts[index] = true; timeouts[index] = true;
}, value); }, value);
const handle = setInterval(function() { const handle = setInterval(() => {
clearInterval(handle); // disarm timer or we'll never finish clearInterval(handle); // disarm timer or we'll never finish
intervals[index] = true; intervals[index] = true;
}, value); }, value);
@ -68,9 +68,9 @@ inputs.forEach(function(value, index) {
// All values in inputs array coerce to 1 ms. Therefore, they should all run // All values in inputs array coerce to 1 ms. Therefore, they should all run
// before a timer set here for 2 ms. // before a timer set here for 2 ms.
setTimeout(common.mustCall(function() { setTimeout(common.mustCall(() => {
// assert that all other timers have run // assert that all other timers have run
inputs.forEach(function(value, index) { inputs.forEach((value, index) => {
assert(timeouts[index]); assert(timeouts[index]);
assert(intervals[index]); assert(intervals[index]);
}); });