-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: adding mustCall in test-timers-clearImmediate.js #12598
Changes from 3 commits
60ac964
8f439e2
69222b5
6eb7161
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
'use strict'; | ||
require('../common'); | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
|
||
const N = 3; | ||
let count = 0; | ||
|
||
function next() { | ||
const immediate = setImmediate(function() { | ||
clearImmediate(immediate); | ||
++count; | ||
}); | ||
const immediate = setImmediate(common.mustCall(() => clearImmediate(immediate))); | ||
} | ||
for (let i = 0; i < N; ++i) | ||
next(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this test even do anything without this loop? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the below code work? It doesn't complain when I run test.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it doesn't complain, that means the test is passing (or possibly not even doing anything). I think you should:
|
||
|
||
process.on('exit', () => { | ||
assert.strictEqual(count, N, `Expected ${N} immediate callback executions`); | ||
}); | ||
for(let i = 0; i < N; i++) { | ||
next(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this loop is still needed?