go-testdeep v1.7.0 Release Notes
Release Date: 2020-07-19 // about 3 years ago-
๐ New features:
๐ new (*td.T).RunAssertRequire function. Useful to avoid boilerplate code:
t.RunAssertRequire("GetAge", func (assert *td.T, require *td.T) { age, err := GetAge("Bob") require.CmpNoError(err) assert.Cmp(age, 42) })
๐ new tdhttp.TestAPI method Or(), useful to debug a test failure:
ta.Get("/person/42", "Accept", "application/json"). CmpJSONBody(td.JSON(
{"id": $1, "name": "Bob"}
, td.NotZero())). Or(func (body string) { t.Logf("received unexpected body: <%s>", body) })
๐ see the Or() documentation as the passed function can have a much more complex signature. It is inspired by Test::Mojo or() method and allows to easily inspect the response of the requested API when the checks fail.
๐ Fixes:
- โ #101 โ some data recursion cases were not correctly handled (reported and tested by @stewi1014);
- some panics due to the user misbehavior were not properly red-colored;
- โ
(*td.T).Run:
t.Config
is now copied instead of shared before using it in sub-func; - โ๏ธ typos in doc.
Enjoy!
Previous changes from v1.6.0
-
๐ Changes:
- โ
td.TestingFT
interface is deprecated (but still usable) and superseded bytesting.TB
standard one: it allows to work with*testing.B
instances as well (or any other type implementingtesting.TB
); โ
(*td.T).RunT()
is deprecated (but still usable) and superseded by(*td.T).Run()
which now delegates totd.T.TB
if it implements aRun()
method with the following signature:(X) Run(string, func(X)) bool
๐ฅ Breaking changes:
- โ
as
td.TestingFT
interface is now an alias ontesting.TB
, it does not containRun(string,ย funcย (*testing.T)) bool
anymore; it is quite unlikely that
(*td.T).Run(string, func (*testing.T))
method is used, but if it is, all calls have to be replaced by(*td.T).Run(string,ย funcย (*td.T))
like in:tt.Run("my_test", func (tt *td.T) { t := tt.TB.(testing.T) ...})
โ note that even though
(*td.T).RunT()
is deprecated, it still works as expected. - โ