Changes all the matchers to use generics instead of reflection. Some still use a bit of reflection, e.g. TypeName etc.
Other major changes:
ValueContaining has been split into StringContaining, MapContaining, MapContainingValues, MapMatchingValues, ArrayContaining and ArrayMatching.
No longer panics with unknown types, as types will fail at compile time.
Some idiosyncrasies with the generic types do exist, but this is language specific;
map matchers generally need to know the type of the map key values explicitly or the compiler will complain, e.g.
then.AssertThat(testing, map[string]bool{"hi": true, "bye": true}, has.AllKeys[string, bool]("hi", "bye"))
has.Length() is likewise pernickety about types being explicit, mainly because it works on both strings and arrays. It needs to know both the type of the array and the array/string type. Confused? me too.
is.LessThan and is.GreaterThan no longer work on complex types. This is because the complex types do not support the comparison operators (yet, somehow, they could be compared by reflection 🤷 )
Coverage: 100.0%. Remained the same when pulling 4ea9cb688925b2bd7944e33c1c55519b12b8b298 on generics into 38dfeaf3bfcde2bfd787e2f8bab6a49785b7dc03 on master.
v.1.1.0 - generics
Changes all the matchers to use generics instead of reflection. Some still use a bit of reflection, e.g. TypeName etc.
Other major changes:
ValueContaining
has been split intoStringContaining
,MapContaining
,MapContainingValues
,MapMatchingValues
,ArrayContaining
andArrayMatching
.Some idiosyncrasies with the generic types do exist, but this is language specific;
then.AssertThat(testing, map[string]bool{"hi": true, "bye": true}, has.AllKeys[string, bool]("hi", "bye"))
See the
matcher_test.go
file for full usage.