go-testdeep v1.7.0 Release Notes

Release Date: 2020-07-19 // almost 4 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.


Previous changes from v1.6.0

  • ๐Ÿ”„ Changes:

    • โœ… td.TestingFT interface is deprecated (but still usable) and superseded by testing.TB standard one: it allows to work with *testing.B instances as well (or any other type implementing testing.TB);
    • โœ… (*td.T).RunT() is deprecated (but still usable) and superseded by (*td.T).Run() which now delegates to td.T.TB if it implements a Run() method with the following signature:

      (X) Run(string, func(X)) bool

    ๐Ÿ’ฅ Breaking changes:

    • โœ… as td.TestingFT interface is now an alias on testing.TB, it does not contain Run(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.