Skip to content

v1.12.0

Compare
Choose a tag to compare
@maxatome maxatome released this 07 Aug 17:50
· 76 commits to master since this release

New features

  • Struct & SStruct can override model fields in expectedFields, as in:
      td.Cmp(t, got, td.Struct(
        Person{
          Name:     "John Doe",
          Age:      23,
          Children: 4,
        },
        td.StructFields{
          "> Age":     td.Between(40, 45),
          ">Children": 0, // spaces after ">" are optional
        }),
      )
  • Struct & SStruct expectedFields is now optional or multiple. If multiple, all maps are merged from left to right;
  • try to detect wrongly defined hooks in tdsuite @deathiop
    Given the 5 hooks:
  • try to detect possible tdsuite.Run() misuse, warn the user when it is called with a non-pointer suite, and some key methods are only available via a pointer suite;
  • add tdhttp.Options function & tdhttp.TestAPI.Options method;
  • Code can now officially delegate its comparison, using two new kinds of function:
    • func(t *td.T, arg)
    • func(assert, require *td.T, arg)
      this way the usage of *td.T methods is secure. Note that these functions do not return anything;
  • using a *td.T instance as Cmp* first parameter now allows to inherit its configuration.
    td.Cmp(td.Require(t), got, 42)
    is the same as:
    td.Require(t).Cmp(got, 42)

Fixes

Miscellaneous

  • enhance & refactor doc comments with new go 1.19 features;
  • documentation now uses any instead of interface{};
  • fix typos.

As usual: enjoy! :)