From ff8202c6f475973c8674e61c794b77e1b072144b Mon Sep 17 00:00:00 2001 From: Roman Reiss Date: Fri, 29 May 2015 19:28:01 +0200 Subject: [PATCH] test: fix undeclared variable access Fixes all cases of undeclared variable access as uncovered by the no-undef rule of eslint. PR-URL: https://github.com/nodejs/io.js/pull/1794 Reviewed-By: Trevor Norris --- test/parallel/test-cluster-worker-exit.js | 16 ++++++---------- test/parallel/test-cluster-worker-kill.js | 14 +++++--------- test/pummel/test-net-timeout.js | 2 +- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/test/parallel/test-cluster-worker-exit.js b/test/parallel/test-cluster-worker-exit.js index 982b099cd1cfe1..3607a992a33dff 100644 --- a/test/parallel/test-cluster-worker-exit.js +++ b/test/parallel/test-cluster-worker-exit.js @@ -106,17 +106,13 @@ function checkResults(expected_results, results) { var actual = results[k], expected = expected_results[k]; - if (typeof expected === 'function') { - expected(r[k]); - } else { - var msg = (expected[1] || '') + - (' [expected: ' + expected[0] + ' / actual: ' + actual + ']'); + var msg = (expected[1] || '') + + (' [expected: ' + expected[0] + ' / actual: ' + actual + ']'); - if (expected && expected.length) { - assert.equal(actual, expected[0], msg); - } else { - assert.equal(actual, expected, msg); - } + if (expected && expected.length) { + assert.equal(actual, expected[0], msg); + } else { + assert.equal(actual, expected, msg); } } } diff --git a/test/parallel/test-cluster-worker-kill.js b/test/parallel/test-cluster-worker-kill.js index c73cf2dbd5216e..e12b466610171a 100644 --- a/test/parallel/test-cluster-worker-kill.js +++ b/test/parallel/test-cluster-worker-kill.js @@ -106,16 +106,12 @@ function checkResults(expected_results, results) { var actual = results[k], expected = expected_results[k]; - if (typeof expected === 'function') { - expected(r[k]); + var msg = (expected[1] || '') + + (' [expected: ' + expected[0] + ' / actual: ' + actual + ']'); + if (expected && expected.length) { + assert.equal(actual, expected[0], msg); } else { - var msg = (expected[1] || '') + - (' [expected: ' + expected[0] + ' / actual: ' + actual + ']'); - if (expected && expected.length) { - assert.equal(actual, expected[0], msg); - } else { - assert.equal(actual, expected, msg); - } + assert.equal(actual, expected, msg); } } } diff --git a/test/pummel/test-net-timeout.js b/test/pummel/test-net-timeout.js index 347e3a4344d37b..25544a6d5f5989 100644 --- a/test/pummel/test-net-timeout.js +++ b/test/pummel/test-net-timeout.js @@ -79,7 +79,7 @@ process.on('exit', function() { assert.ok(starttime != null); assert.ok(timeouttime != null); - diff = timeouttime - starttime; + var diff = timeouttime - starttime; console.log('diff = ' + diff); assert.ok(timeout < diff);