Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

test: update coverage for dgram.js #10783

Closed
wants to merge 1 commit into from

Conversation

hiroppy
Copy link
Member

@hiroppy hiroppy commented Jan 13, 2017

Create test-dgram-multicast-loopback.js for dgram.setMulticastLoopback.
Add a test which has an argument of an invalid number to test-dgram-setTTL.js.
https://github.com/nodejs/node/blob/master/lib/dgram.js#L464
Add a test which has an argument of a string to test-dgram-multicast-setTTL.js.
https://github.com/nodejs/node/blob/master/lib/dgram.js#L473

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. dont-land-on-v7.x labels Jan 13, 2017
@mscdex mscdex added dgram Issues and PRs related to the dgram subsystem / UDP. and removed dont-land-on-v7.x labels Jan 13, 2017
Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

This is close! Left a few comments.

const socket = dgram.createSocket('udp4');

socket.bind(0);
socket.on('listening', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Please wrap the callback here in common.mustCall()


socket.bind(0);
socket.on('listening', function() {
socket.setMulticastTTL(16);
socket.on('listening', () => {
Copy link
Member

Choose a reason for hiding this comment

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

common.mustCall() here as well.

} catch (e) {
thrown = true;
}
}, /setMulticastTTL/, 'TTL must be a number from > 0 to < 256');
Copy link
Member

Choose a reason for hiding this comment

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

The regex should test the entire error message

@hiroppy
Copy link
Member Author

hiroppy commented Jan 13, 2017

@jasnell Updated! PTAL:)

@jasnell
Copy link
Member

jasnell commented Jan 15, 2017

socket.on('listening', common.mustCall(() => {
const result = socket.setMulticastLoopback(16);
assert.strictEqual(result, 16);

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove this line please.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, Deleted :)

Create test-dgram-multicast-loopback.js for dgram.setMulticastLoopback.
Add a test which has an argument of an invalid number to test-dgram-setTTL.js.
https://github.com/nodejs/node/blob/master/lib/dgram.js#L464
Add a test which has an argument of a string to test-dgram-multicast-setTTL.js.
https://github.com/nodejs/node/blob/master/lib/dgram.js#L473
@italoacasas
Copy link
Contributor

one more CI before merging
https://ci.nodejs.org/job/node-test-pull-request/5896/console

@hiroppy
Copy link
Member Author

hiroppy commented Jan 17, 2017

maybe the same reason
#10808 (comment)

@italoacasas
Copy link
Contributor

Landed 2057a63

italoacasas pushed a commit that referenced this pull request Jan 17, 2017
PR-URL: #10783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
PR-URL: nodejs#10783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@hiroppy hiroppy deleted the feature/add-tests-to-dgram branch January 21, 2017 08:11
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 23, 2017
PR-URL: nodejs#10783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
targos pushed a commit that referenced this pull request Jan 28, 2017
PR-URL: #10783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@italoacasas italoacasas mentioned this pull request Jan 29, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
PR-URL: nodejs#10783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
PR-URL: nodejs#10783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
jasnell pushed a commit that referenced this pull request Mar 8, 2017
PR-URL: #10783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
jasnell pushed a commit that referenced this pull request Mar 8, 2017
PR-URL: #10783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
PR-URL: #10783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Mar 9, 2017
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
PR-URL: #10783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Mar 9, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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.

6 participants