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

Added IsNil and IsNotNil assertions #49

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

Conversation

lukaszb
Copy link

@lukaszb lukaszb commented Jan 21, 2016

No description provided.

@marcosnils
Copy link
Member

@lukaszb thanks for the contribution. I like the idea of adding these type of assertions but we need to make sure to catch nil structs as well. I.E:

var nilStruct struct{}
g.It("IsNil should trigger", func() {
    g.Assert(nilStruct).IsNil()
})

Currently this fails, It'd be nice if we could catch these scenarios also.

@lukaszb
Copy link
Author

lukaszb commented Jan 21, 2016

@marcosnils sure, can do that. btw, can you look at travis failed build? It seems to fail for code I haven't actually touched.

@ammario
Copy link

ammario commented Sep 16, 2016

var nilStruct struct{}

This struct is zeroed, not nil (only pointers can be nil) so the behavior could be misleading.

IsZero() / IsNotZero() are probably better names for this more flexible functionality.

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.

None yet

3 participants