Skip to content

Conversation

Trott
Copy link
Member

@Trott Trott commented Jun 11, 2017

Add common.mustCall() check to test-child-process-stdio-big-write-end.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test child_process

Add common.mustCall() check to test-child-process-stdio-big-write-end.
@Trott Trott added child_process Issues and PRs related to the child_process subsystem. test Issues and PRs related to the tests. labels Jun 11, 2017
@@ -43,10 +43,10 @@ function parent() {
child.stdout.on('data', function(c) {
Copy link
Contributor

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 n is asserted, but this will give a one-step-closer-to-root-cause assertion error)

Copy link
Member Author

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 n will occur before any assertion by mustCallAtLeast().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack.

@@ -43,10 +43,10 @@ function parent() {
child.stdout.on('data', function(c) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack.

@@ -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);
console.log('ok');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove (maybe replace with comment // end of test)

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the + is cheating the strict
either put on the right side send + '\n' ('\n' is because data comes from console.log)
or replace the 'data' handler with:

  let n = 0;
  child.stdout.setEncoding('ascii');
  child.stdout.on('data', function(d) {
    const c = Number(d);
    if (!c) assert.fail(c);
    n += c;
  });

@Trott
Copy link
Member Author

Trott commented Jun 13, 2017

jasnell pushed a commit that referenced this pull request Jun 13, 2017
Add common.mustCall() check to test-child-process-stdio-big-write-end.

PR-URL: #13605
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@jasnell
Copy link
Member

jasnell commented Jun 13, 2017

Landed in f308b4d

@jasnell jasnell closed this Jun 13, 2017
addaleax pushed a commit that referenced this pull request Jun 17, 2017
Add common.mustCall() check to test-child-process-stdio-big-write-end.

PR-URL: #13605
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@addaleax addaleax mentioned this pull request Jun 17, 2017
addaleax pushed a commit that referenced this pull request Jun 21, 2017
Add common.mustCall() check to test-child-process-stdio-big-write-end.

PR-URL: #13605
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@addaleax addaleax mentioned this pull request Jun 21, 2017
MylesBorins pushed a commit that referenced this pull request Aug 14, 2017
Add common.mustCall() check to test-child-process-stdio-big-write-end.

PR-URL: #13605
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Aug 16, 2017
Add common.mustCall() check to test-child-process-stdio-big-write-end.

PR-URL: #13605
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants