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

'ShouldEqual' should panic when trying to compare different types #348

Closed
mattwarren1234 opened this issue Sep 18, 2015 · 3 comments
Closed

Comments

@mattwarren1234
Copy link

The below example should panic:

So("2", ShouldEqual, 2)

Instead it displays the following message (test fails, for seemingly no reason):
image

@mdwhatcott
Copy link
Collaborator

Thanks for bringing this to my attention.

Note to self: This is actually an issue with the assertions package, not the GoConvey project.

Hmm, I disagree with the idea that the assertions package or even the convey package should panic in a failure scenario. I would say we just need more helpful error message. Something like:

Expected: '2' (string)
Actual:   '2' (int)
(Should be equal)

Keep in mind that you can currently compare the int value 2 with the int64 value 2 without any problems. I wouldn't want to disrupt that behavior.

I'll take a look at this.

@mattwarren1234
Copy link
Author

Yeah, listing types would be even more helpful!

@mdwhatcott
Copy link
Collaborator

Pull the latest:

go get -u github.com/smartystreets/assertions

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

No branches or pull requests

2 participants