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

Add unit test for procnettcp.ParseAddress #2914

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexandear
Copy link
Member

This PR adds unit test for the procnettcp.ParseAddress function.

Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

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

Thanks, the tests are good, but I think they can be improved a little.

},
{
input: "invalid:address",
expectedErrSubstr: `unparsable address "invalid:address"`,
Copy link
Member

Choose a reason for hiding this comment

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

Include the "expected length" part in the error string for this test case.

},
{
input: "0100007F:0050:00",
expectedErrSubstr: `0100007F:0050:00"`,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
expectedErrSubstr: `0100007F:0050:00"`,
expectedErrSubstr: `unparsable address "0100007F:0050:00"`,

expectedErrSubstr: `0100007F:0050:00"`,
},
{
input: "0100007F0050",
Copy link
Member

Choose a reason for hiding this comment

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

I would make this one 8 characters, to make sure it is rejected because it doesn't include a port number, and not because it is the wrong length.

Maybe move it to the top, as the missing colon is the first thing that is tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants