-
Notifications
You must be signed in to change notification settings - Fork 17
Include types of values in assertion failures #178
Open
Description
I recently ran into what I thought was a bug when I saw this error from a simple spec:
String#to_i String#to_i String#to_i defaults to parsing in base 10
Assertion failed: `left == right`
left: 1234567890
right: 1234567890
The spec in question looks like this:
assert("1234567890").equals(1234567890)
I was confused at first because the values look the same in the error output. Looking at the code, it's (somewhat) obvious that the failure comes from the fact that the types of the values do not match, even though the string representation of the values do (one's a String, the other's an Integer).
To mitigate this, I'd like to see the type of the value added to the assertion failure output. With that, I would expect it to look something like:
String#to_i String#to_i String#to_i defaults to parsing in base 10
Assertion failed: `left == right`
left: 1234567890 (String)
right: 1234567890 (Integer)
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackNo fields configured for issues without a type.