Skip to content

v1.16.0

Latest

Choose a tag to compare

@maxatome maxatome released this 20 Aug 08:10
· 1 commit to master since this release
03b7af4

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).Must3 methods are available, they produce nice error messages instead of ugly panics raised by legacy Must, Must2 and Must3 functions:
    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
  • Smuggle can chain functions without the need to call Smuggle again 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, SuperJSONOf and JSONPointer can now use encoding/json/v2 to marshal/unmarshal. Simply add the needed encoding/json/v2.Options to their parameters. By default encoding/json is 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