Browse Source

test: add mustCall in test-timers-clearImmediate

PR-URL: https://github.com/nodejs/node/pull/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>
v7.x
Zahidul Islam 8 years ago
committed by Evan Lucas
parent
commit
d15b1c4446
  1. 19
      test/parallel/test-timers-clearImmediate.js

19
test/parallel/test-timers-clearImmediate.js

@ -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();
}

Loading…
Cancel
Save