-
Notifications
You must be signed in to change notification settings - Fork 606
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
base: master
Are you sure you want to change the base?
Add unit test for procnettcp.ParseAddress #2914
Conversation
Signed-off-by: Oleksandr Redko <[email protected]>
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.
Thanks, the tests are good, but I think they can be improved a little.
}, | ||
{ | ||
input: "invalid:address", | ||
expectedErrSubstr: `unparsable address "invalid:address"`, |
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.
Include the "expected length" part in the error string for this test case.
}, | ||
{ | ||
input: "0100007F:0050:00", | ||
expectedErrSubstr: `0100007F:0050:00"`, |
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.
expectedErrSubstr: `0100007F:0050:00"`, | |
expectedErrSubstr: `unparsable address "0100007F:0050:00"`, |
expectedErrSubstr: `0100007F:0050:00"`, | ||
}, | ||
{ | ||
input: "0100007F0050", |
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.
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.
This PR adds unit test for the
procnettcp.ParseAddress
function.