Skip to content
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: improve assertion message in dgram test #16029

Closed
wants to merge 1 commit into from
Closed

test: improve assertion message in dgram test #16029

wants to merge 1 commit into from

Conversation

shakeelmohamed
Copy link
Contributor

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

test

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Oct 6, 2017
@joyeecheung
Copy link
Member

@mscdex mscdex added the dgram Issues and PRs related to the dgram subsystem / UDP. label Oct 6, 2017
@Trott Trott added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Oct 6, 2017
@@ -15,7 +15,8 @@ function onsend() {
if (sent++ < limit) {
client.send(chunk, 0, chunk.length, port, common.localhostIPv4, onsend);
} else {
assert.strictEqual(async, true, 'Send should be asynchronous.');
assert.strictEqual(async, true, `Send should be asynchronous.
Saw ${sent} messages, expected fewer than ${limit}.`);
Copy link
Member

Choose a reason for hiding this comment

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

Please do not use multiline template strings. This adds lots of whitespace to the message. Instead a string concat should be used here (and the template string in the second line).

Copy link
Member

Choose a reason for hiding this comment

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

You might also just remove the message all together as that would also increase the readability a lot.

Copy link
Member

Choose a reason for hiding this comment

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

@shakeelmohamed ... thank you so much for the pull request and for participating in the code and learn! As @BridgeAR indicates, multiline template strings are less than ideal and are not something that we use generally. Also, the added message does not quite fit the check. As @BridgeAR suggests, I would just remove the message altogether and leave it as assert.strictEqual(async, true).

Copy link
Contributor Author

@shakeelmohamed shakeelmohamed Oct 10, 2017

Choose a reason for hiding this comment

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

Thanks for the feedback @BridgeAR @jasnell, I did the lazy person's force push (delete remote branch, squash locally, re-push branch) and had to create a new PR: #16121

@shakeelmohamed shakeelmohamed deleted the test-dgram-send-cb-recursive-message-text branch October 10, 2017 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. dgram Issues and PRs related to the dgram subsystem / UDP. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants