-
Notifications
You must be signed in to change notification settings - Fork 1.7k
assert: add Kind and NotKind #1803
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
base: master
Are you sure you want to change the base?
Conversation
dolmen
left a comment
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.
Incomplete test suite.
| if h, ok := t.(tHelper); ok { | ||
| h.Helper() | ||
| } | ||
|
|
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 case where expectedKind == reflect.Invalid must be rejected (and added to test cases).
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 for catching this.
I've updated to handle this
| h.Helper() | ||
| } | ||
|
|
||
| objectKind := reflect.TypeOf(object).Kind() |
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.
object must be checked for nil and rejected before calling reflect.TypeOf (another missing test case).
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 for catching this.
I've updated to handle this
| if h, ok := t.(tHelper); ok { | ||
| h.Helper() | ||
| } | ||
|
|
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.
Same issues as in Kind:
- check for
reflect.InvalidexpectedKind - check for
nilobject
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.
Updated, thank you.
Summary
Continues work from #1049 by @matinFT.
This PR rebases with the latest master, fixes according the original PR's comments by @dolmen , and also add
NotKindto adhere to the API convention.This fixes #633
Changes
Add
KindandNotKindfunction inassertpackage.Motivation
See #633
Related issues
Closes #633