From 4243ce03182aea72aefdd2ff29ecc1affbc59716 Mon Sep 17 00:00:00 2001 From: Andres Date: Tue, 13 Apr 2021 23:30:12 -0300 Subject: [PATCH] test: replace function with arrow function and remove unused argument PR-URL: https://github.com/nodejs/node/pull/38235 Reviewed-By: Yash Ladha Reviewed-By: Pooja D P Reviewed-By: Harshitha K P Reviewed-By: Benjamin Gruenbaum Reviewed-By: Rich Trott Reviewed-By: Darshan Sen Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel --- test/parallel/test-readline-interface.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index afa9fd33d22c4f..a3020181b3532e 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -277,7 +277,7 @@ function assertCursorRowsAndCols(rli, rows, cols) { const expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat']; // ['foo', 'baz', 'bar', bat']; let callCount = 0; - rli.on('line', function(line) { + rli.on('line', (line) => { assert.strictEqual(line, expectedLines[callCount]); callCount++; }); @@ -353,7 +353,7 @@ function assertCursorRowsAndCols(rli, rows, cols) { }); const expectedLines = ['foo', 'bar', 'baz', 'bar', 'bat', 'bat']; let callCount = 0; - rli.on('line', function(line) { + rli.on('line', (line) => { assert.strictEqual(line, expectedLines[callCount]); callCount++; }); @@ -380,7 +380,7 @@ function assertCursorRowsAndCols(rli, rows, cols) { const [rli, fi] = getInterface({ terminal: true }); const keys = []; const err = new Error('bad thing happened'); - fi.on('keypress', function(key) { + fi.on('keypress', (key) => { keys.push(key); if (key === 'X') { throw err; @@ -795,7 +795,7 @@ for (let i = 0; i < 12; i++) { assert.strictEqual(isWarned(process.stdout._events), false); } -[true, false].forEach(function(terminal) { +[true, false].forEach((terminal) => { // Disable history { const [rli, fi] = getInterface({ terminal, historySize: 0 }); @@ -890,7 +890,7 @@ for (let i = 0; i < 12; i++) { const buf = Buffer.from('☮', 'utf8'); const [rli, fi] = getInterface({ terminal }); let callCount = 0; - rli.on('line', function(line) { + rli.on('line', (line) => { callCount++; assert.strictEqual(line, buf.toString('utf8')); }); @@ -1004,7 +1004,7 @@ for (let i = 0; i < 12; i++) { rli.setPrompt('ddd> '); rli.prompt(); rli.write("really shouldn't be seeing this"); - rli.question('What do you think of node.js? ', function(answer) { + rli.question('What do you think of node.js? ', (answer) => { console.log('Thank you for your valuable feedback:', answer); rli.close(); }); @@ -1056,7 +1056,7 @@ for (let i = 0; i < 12; i++) { const crlfDelay = 200; const [rli, fi] = getInterface({ terminal, crlfDelay }); let callCount = 0; - rli.on('line', function(line) { + rli.on('line', () => { callCount++; }); fi.emit('data', '\r'); @@ -1078,7 +1078,7 @@ for (let i = 0; i < 12; i++) { const delay = 200; const [rli, fi] = getInterface({ terminal, crlfDelay }); let callCount = 0; - rli.on('line', function(line) { + rli.on('line', () => { callCount++; }); fi.emit('data', '\r');