-
Notifications
You must be signed in to change notification settings - Fork 20
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
{Bool,Binary,UnixMilli}#MarshalJSON(): return valid JSON, not empty string #612
{Bool,Binary,UnixMilli}#MarshalJSON(): return valid JSON, not empty string #612
Conversation
…tring in case an instance is null.
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.
The changes are fine, however if there were units for them from the beginning, such bugs would have been easy to spot. Thus, it would be nice if you could add the missing unit tests here as well.
38de7ed
to
698e332
Compare
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 don't quite get why you're asserting the tests manually and with some type reflecting to top it all off. Why can't you just use require.*
and assert.*
?
I copy&paste-d existing pkg/icingadb/objectpacker/objectpacker_test.go |
And why does it have to be exactly the same here? If you just want to extend the error messages and add some contexts in case of errors, you can do that with |
698e332
to
b0f2aa3
Compare
b0f2aa3
to
4f3607f
Compare
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.
LGTM!
4f3607f
to
03d49a9
Compare
03d49a9
to
8815e04
Compare
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.
Please give the sub-tests proper names. The spaces you use are not valid in test names so they are already replaces with _
and the special characters make it annoying to use with something like go test -run
, which takes regexes, so escaping is needed:
go test -v -run 'TestUnixMilli_MarshalJSON/0001-01-01_00:00:00_\+0000_UTC_\(Unix:_-62135596800\)' ./pkg/types
8815e04
to
b8ed25c
Compare
in case an instance is null.