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>
This commit is contained in:
parent
d457a986a0
commit
c405497086
@ -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;
|
||||
});
|
||||
}
|
||||
for (let i = 0; i < N; ++i)
|
||||
next();
|
||||
|
||||
process.on('exit', () => {
|
||||
assert.strictEqual(count, N, `Expected ${N} immediate callback executions`);
|
||||
});
|
||||
function next() {
|
||||
const fn = common.mustCall(() => clearImmediate(immediate));
|
||||
const immediate = setImmediate(fn);
|
||||
}
|
||||
|
||||
for (let i = 0; i < N; i++) {
|
||||
next();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user