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 <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
ChatbotSchool authored and evanlucas committed May 2, 2017
1 parent 47faa02 commit 29641c8
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 29641c8

Please sign in to comment.