Skip to content

Releases: maxatome/go-testdeep

v1.7.0

19 Jul 22:26
4e4c30d
Compare
Choose a tag to compare

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!

v1.6.0

31 May 19:00
5b2d586
Compare
Choose a tag to compare

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.

v1.5.0

17 May 09:17
e810e73
Compare
Choose a tag to compare

New features:

  • new Flatten function: useful to flatten non interface{} slices in Set, Bag arguments (but not only, read the doc);
  • panic messages due to user misuse of go-testdeep functions/methods are now red colored to help her/him to focus on her/his mistake and not think go-testdeep failed shamefully;
  • delay colors initialization to the first use. So colors can now be disabled in golang playgroung. See the corresponding FAQ point;
  • optimize some type retrievals.

Fix:

  • forbid Isa(nil) because it is a nonsense and so avoid a deep panic.

New FAQ entries:

Enjoy and do not forget to star!

v1.4.0

11 Apr 23:01
77a2485
Compare
Choose a tag to compare

New features:

  • tdhttp package (aka HTTP API tester) enhanced and fully documented;
  • new Delay operator;
  • Contains operator reworked, smarter and []byte specifically handled;
  • String, HasPrefix and HasSuffix operators now operate on []byte too.

Fixes:

  • anchor feature on 32 bits platforms;
  • missing comments + typos.

Enjoy, but at home! ;)

v1.3.0

29 Feb 11:09
3b6ee0d
Compare
Choose a tag to compare

Package github.com/maxatome/go-testdeep is deprecated, it is recommended to use github.com/maxatome/go-testdeep/td in new code.

github.com/maxatome/go-testdeep is still usable so the compatibility is preserved.

The only breaking change is the disappearance of testdeep.DefaultContextConfig. It should be replaced by td.DefaultContextConfig and so the go-testdeep import line should be changed (at least "github.com/maxatome/go-testdeep/td" should be added).

To summarize: migration to github.com/maxatome/go-testdeep/td is not needed, only recommended, except if testdeep.DefaultContextConfig is used.

To migrate:

import "github.com/maxatome/go-testdeep"testdeep.DefaultContextConfig = testdeep.ContextConfig{…}
testdeep.Cmp(…)

or with "td" package alias:

import td "github.com/maxatome/go-testdeep"
…
td.DefaultContextConfig = td.ContextConfig{…}
td.Cmp(…)

simply do (see import line changes):

import "github.com/maxatome/go-testdeep/td"
…
td.DefaultContextConfig = td.ContextConfig{…}
td.Cmp(…)

See the FAQ point for details about this migration.

And still, do not forget to visit https://go-testdeep.zetta.rocks/ and open an issue if something seems to be missing or not clear.

Happy testing!

v1.2.0

13 Feb 21:07
7d05925
Compare
Choose a tag to compare

New features:

Synopsis revisited (again)!

Enjoy powerful testing!

v1.1.2

18 Nov 23:09
730ea81
Compare
Choose a tag to compare

New features:

Synopsis revisited!

Enjoy powerful API testing!

v1.1.1

03 Nov 21:14
96b9c40
Compare
Choose a tag to compare

News:

New features:

v1.1.0

07 Jul 13:59
ff0ad83
Compare
Choose a tag to compare

New features:

Breaking changes:

Bugs fixes:

  • Fix a bug when compared slices have the same backend array.

Misc:

v1.0.8

14 Jan 23:27
4ea8fb8
Compare
Choose a tag to compare