Browse Source

test: run all of test-timers-blocking-callback

The test has two test cases, but only the first was being run due to a
small bug. This change fixes the bug.

PR-URL: https://github.com/nodejs/node/pull/9305
Reviewed-By: Julien Gilli <jgilli@nodejs.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
v6.x
Rich Trott 8 years ago
committed by Myles Borins
parent
commit
4fcc2c1d3b
  1. 10
      test/parallel/test-timers-blocking-callback.js

10
test/parallel/test-timers-blocking-callback.js

@ -56,24 +56,24 @@ function blockingCallback(callback) {
common.busyLoop(TIMEOUT); common.busyLoop(TIMEOUT);
timeCallbackScheduled = Timer.now(); timeCallbackScheduled = Timer.now();
setTimeout(blockingCallback, TIMEOUT); setTimeout(blockingCallback.bind(null, callback), TIMEOUT);
} }
} }
function testAddingTimerToEmptyTimersList(callback) { const testAddingTimerToEmptyTimersList = common.mustCall(function(callback) {
initTest(); initTest();
// Call setTimeout just once to make sure the timers list is // Call setTimeout just once to make sure the timers list is
// empty when blockingCallback is called. // empty when blockingCallback is called.
setTimeout(blockingCallback.bind(null, callback), TIMEOUT); setTimeout(blockingCallback.bind(null, callback), TIMEOUT);
} });
function testAddingTimerToNonEmptyTimersList() { const testAddingTimerToNonEmptyTimersList = common.mustCall(function() {
initTest(); initTest();
// Call setTimeout twice with the same timeout to make // Call setTimeout twice with the same timeout to make
// sure the timers list is not empty when blockingCallback is called. // sure the timers list is not empty when blockingCallback is called.
setTimeout(blockingCallback, TIMEOUT); setTimeout(blockingCallback, TIMEOUT);
setTimeout(blockingCallback, TIMEOUT); setTimeout(blockingCallback, TIMEOUT);
} });
// Run the test for the empty timers list case, and then for the non-empty // Run the test for the empty timers list case, and then for the non-empty
// timers list one // timers list one

Loading…
Cancel
Save