Features
- Thanks to go1.27, anchoring can now be achieved using methods
(*T).AT&(*T).AnchorT:// before td.A[int](assert, td.Between(41, 43)) // now assert.AT[int](td.Between(41, 43))
- Still thanks to go1.27, new
(*T).Must,(*T).Must2&(*T).Must3methods are available, they produce nice error messages instead of ugly panics raised by legacyMust,Must2andMust3functions:myFunction := func() (int, error) { ... } // before val := td.Must(myFunction()) // panics if an error is returned // now val := assert.Must(myFunction()) // nice error message & FailNow if an error is returned
Smugglecan chain functions without the need to callSmuggleagain and again:// before td.Cmp(t, `000123456789`, td.Smuggle(strconv.Atoi, td.Smuggle(strconv.Itoa, `123456789`))) // now td.Cmp(t, `000123456789`, td.Smuggle(strconv.Atoi, strconv.Itoa, `123456789`))
JSON,SubJSONOf,SuperJSONOfandJSONPointercan now useencoding/json/v2to marshal/unmarshal. Simply add the neededencoding/json/v2.Optionsto their parameters. By defaultencoding/jsonis still used.
What's Changed in details
- test: use golangci-lint v2.12.2 by @maxatome in #289
- Make go1.27 happy by @maxatome in #290
- feat(Smuggle): allow implicit chaining of functions by @maxatome in #292
- feat: add (*T).Must, (*T).Must2 & (*T).Must3 methods (need go1.27) by @maxatome in #293
- feat: add T.AT & T.AnchorT generic anchor methods (need go1.27) by @maxatome in #291
- feat(JSON,JSONPointer): add support for encoding/json/v2 by @maxatome in #294
- test: test with go v1.27 & golangci-lint v2.13.0 by @maxatome in #294
Full Changelog: v1.15.0...v1.16.0