Skip to content

v1.7.0

Compare
Choose a tag to compare
@maxatome maxatome released this 19 Jul 22:26
· 257 commits to master since this release
4e4c30d

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!