-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
test: add mustCall() to child-process test #13605
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ | |
| // USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| 'use strict'; | ||
| require('../common'); | ||
| const common = require('../common'); | ||
| const assert = require('assert'); | ||
| const BUFSIZE = 1024; | ||
|
|
||
|
|
@@ -43,10 +43,10 @@ function parent() { | |
| child.stdout.on('data', function(c) { | ||
| n += c; | ||
| }); | ||
| child.stdout.on('end', function() { | ||
| child.stdout.on('end', common.mustCall(function() { | ||
| assert.strictEqual(+n, sent); | ||
|
Contributor
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. the let n = 0;
child.stdout.setEncoding('ascii');
child.stdout.on('data', function(d) {
const c = Number(d);
if (!c) assert.fail(c);
n += c;
}); |
||
| console.log('ok'); | ||
|
Contributor
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. Should remove (maybe replace with comment |
||
| }); | ||
| })); | ||
|
|
||
| // Write until the buffer fills up. | ||
| let buf; | ||
|
|
||
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.
How about adding a
mustCallAtLeast?(I see that the value of
nis asserted, but this will give a one-step-closer-to-root-cause assertion error)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.
If I understand correctly, the assertion on
nwill occur before any assertion bymustCallAtLeast().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.
Ack.