v1.12.0
New features
Struct
&SStruct
can override model fields in expectedFields, as in:td.Cmp(t, got, td.Struct( Person{ Name: "John Doe", Age: 23, Children: 4, }, td.StructFields{ "> Age": td.Between(40, 45), ">Children": 0, // spaces after ">" are optional }), )
Struct
&SStruct
expectedFields is now optional or multiple. If multiple, all maps are merged from left to right;- try to detect wrongly defined hooks in
tdsuite
@deathiop
Given the 5 hooks: - try to detect possible
tdsuite.Run()
misuse, warn the user when it is called with a non-pointer suite, and some key methods are only available via a pointer suite; - add
tdhttp.Options
function &tdhttp.TestAPI.Options
method; Code
can now officially delegate its comparison, using two new kinds of function:func(t *td.T, arg)
func(assert, require *td.T, arg)
this way the usage of*td.T
methods is secure. Note that these functions do not return anything;
- using a
*td.T
instance asCmp*
first parameter now allows to inherit its configuration.is the same as:td.Cmp(td.Require(t), got, 42)
td.Require(t).Cmp(got, 42)
Fixes
Helper()
was not called inT.LogTrace
,T.ErrorTrace
andT.FatalTrace
methods. Fixed;UseEqual
& anchoring feature didn't play well together. Fixed;- panic when comparing nested maps using private fields as key. Fixed.
Miscellaneous
- enhance & refactor doc comments with new go 1.19 features;
- documentation now uses
any
instead ofinterface{}
; - fix typos.
As usual: enjoy! :)