Skip to content

Commit

Permalink
test: add mustCall in test-timers-clearImmediate
Browse files Browse the repository at this point in the history
PR-URL: #12598
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
ChatbotSchool authored and evanlucas committed May 2, 2017
1 parent 46a7c29 commit d15b1c4
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions test/parallel/test-timers-clearImmediate.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
'use strict';
require('../common');
const assert = require('assert');
const common = require('../common');

const N = 3;
let count = 0;

function next() {
const immediate = setImmediate(function() {
clearImmediate(immediate);
++count;
});
const fn = common.mustCall(() => clearImmediate(immediate));
const immediate = setImmediate(fn);
}
for (let i = 0; i < N; ++i)
next();

process.on('exit', () => {
assert.strictEqual(count, N, `Expected ${N} immediate callback executions`);
});
for (let i = 0; i < N; i++) {
next();
}

0 comments on commit d15b1c4

Please sign in to comment.