-
Notifications
You must be signed in to change notification settings - Fork 151
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 json handlers #93
Conversation
version_test.go
Outdated
{"1.2.3", false}, | ||
{"1.2.0-x.Y.0+metadata", false}, | ||
{"1.2.0-x.Y.0+metadata-width-hypen", false}, | ||
{"1.2.3-rc1-with-hypen", false}, | ||
{"1.2.3.4", false}, | ||
{"1.2.0.4-x.Y.0+metadata", false}, | ||
{"1.2.0.4-x.Y.0+metadata-width-hypen", false}, | ||
{"1.2.0-X-1.2.0+metadata~dist", false}, | ||
{"1.2.3.4-rc1-with-hypen", false}, | ||
{"1.2.3.4", false}, |
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.
Not sure what values would make sense to force a failure here.
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.
Hi @jukie,
Thanks for submitting this PR. I don't see much benefit in negative tests here because errors are only returned by code that's not specifically under test by this test function (the standard library json package and the parsing by NewVersion()
). The code that really needs to be tested in your implementation is the transfer of data from the temporary struct to the receiver, and I think the tests you already have cover that logic.
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.
This looks pretty good overall. I think there are some hypen
/hyphen
typos, and the test suite doesn't pass when I run it locally.
@shore looks like I pushed an incomplete commit. Sorry about that, should be actually ready now. |
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.
👍
@shore any chance I could also request for a release cut in the next couple weeks? |
Closes #94
This adds two functions that implement JSON.Unmarshaler and JSON.Marshaler interface to allow for parsing to/from json.