When using suites, test names were just the raw suite method name, but that's often not
detailed enough to know what the problem is. This commit adds the ability to pass a custom
name format using certain formatting marks (sort of similar to templating strings) to
include the name of the function that called Run or NamedRun, the name of the suite's type,
and/or the name of the method.
in `ObjectsAreEqual`, `expectedValue.Convert(actualType)` was being called when
`actualType.ConvertibleTo(reflect.TypeOf(expected))` was true. This was a problem
for situations such as when expected was an int and actual was a string, since
ints are `ConvertibleTo` strings, but the reverse is not true.
Changing the ConvertibleTo check to `expectedValue.Type().ConvertibleTo(actualType)`
solves the issue.
The change in #94 resulted in using == to compare two values that might not be
comparable. Hence, this resulted in a panic for situations like:
ObjectsAreEqual(map[int]int{5: 10}, map[int]int{10: 20})
The fix is to use reflect.DeepEqual() instead.
The previous assert.ObjectsAreEqual() implementation is broken in go 1.4beta1:
x := uint64(3)
log.Printf("equal? %t", assert.ObjectsAreEqual(3, x))
This prints "true" under Go 1.3 and "false" under 1.4beta1 (amd64/darwin).
The reason is that the ObjectsAreEqual() was comparing two reflect.Value values
for equality using ==, but the behavior of that operation is apparently
undefined (https://code.google.com/p/go/issues/detail?id=9034). The fix is to do
the type conversion and then do the comparison between two interface{} values.
When using testify, I saw panic: assert: arguments: Error(0) failed because object wasn't correct type: {{ad6e7d77-1745-4761-6c4b-a79ab92a4a0f e6e975ef-3637-4047-436a-018ee9d2de52 %!s(int=17) <nil> <nil> %!s(bool=false) %!s(*string=<nil>) ...
when using the Error(index) function.
This commit simply changes to using %v for printing the unexpected structure in the Bool, Int, and Error shortcut methods.
Extend tests for NotEqual, Len and add tests for Condition, InEpsilon.
Add tests for Assertion.Condition, Assertion.InEpsilon, Assertion.InDelta
Fix a bug for Assertion.InDelta, Assertion.InEpsilon having incorrect signature.