-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8cdaaa
commit e43961b
Showing
4 changed files
with
43 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('assert'); | ||
const common = require('../common'); | ||
|
||
const N = 3; | ||
let count = 0; | ||
function next() { | ||
const immediate = setImmediate(function() { | ||
// run clearImmediate in the callback. | ||
for (let i = 0; i < 3; ++i) { | ||
const immediate = setImmediate(common.mustCall(function() { | ||
clearImmediate(immediate); | ||
++count; | ||
}); | ||
})); | ||
} | ||
for (let i = 0; i < N; ++i) | ||
next(); | ||
|
||
process.on('exit', () => { | ||
assert.strictEqual(count, N, `Expected ${N} immediate callback executions`); | ||
}); | ||
// run clearImmediate before the callback. | ||
for (let i = 0; i < 3; ++i) { | ||
const immediate = setImmediate(common.mustNotCall(function() {})); | ||
|
||
clearImmediate(immediate); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters