test: adding mustCall in test-timers-clearImmediate.js#12598
test: adding mustCall in test-timers-clearImmediate.js#12598Zahidul-Islam wants to merge 4 commits intonodejs:masterfrom
Conversation
| clearImmediate(immediate); | ||
| ++count; | ||
| }); | ||
| }, 3)); |
There was a problem hiding this comment.
I think we should just use I think we just need N here instead.common.mustCall() without a second argument when the loop below is kept.
| }); | ||
| }, 3)); | ||
| } | ||
| for (let i = 0; i < N; ++i) |
There was a problem hiding this comment.
I think this loop is still needed?
| }, 3)); | ||
| } | ||
| for (let i = 0; i < N; ++i) | ||
| next(); |
There was a problem hiding this comment.
Does this test even do anything without this loop?
There was a problem hiding this comment.
Is the below code work? It doesn't complain when I run test.
'use strict';
const common = require('../common');
const assert = require('assert');
const N = 3;
let count = 0;
function next() {
const immediate = setImmediate(common.mustCall(() => {
clearImmediate(immediate);
++count;
}));
}
for(let i = 0; i < N; i++) {
next();
}
There was a problem hiding this comment.
If it doesn't complain, that means the test is passing (or possibly not even doing anything). I think you should:
- Put the
forloop back. - Remove the
countvariable. - Drop the second argument to
common.mustCall()as @mscdex said.
|
@cjihrig I have updated my commit. |
cjihrig
left a comment
There was a problem hiding this comment.
LGTM once it passes CI. You look to have some linting errors though. Try running make lint locally.
|
@cjihrig I have fixed lint error. |
|
Linux CI issues are build/infrastructure issues and nothing to do with the changes here. CI looks good. |
| }); | ||
| const immediate = setImmediate( | ||
| common.mustCall(() => clearImmediate(immediate)) | ||
| ); |
There was a problem hiding this comment.
Is this indentation off?
jasnell
left a comment
There was a problem hiding this comment.
LGTM with linting errors fixed
PR-URL: nodejs#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>
|
Landed in c405497. |
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>
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>
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>
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>
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>
PR-URL: nodejs/node#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>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)