Skip to content

Releases: maargenton/go-testpredicate

v1.5.0

12 Nov 11:02
be114a7

Choose a tag to compare

Improvements

  • Update value.Field implementation to support '.' in map keys and pointer receiver for method invocation.
  • Add slogtest package for recording structured log output during tests.

Code changes

  • Update value.Field implementation (#30)
  • Add slogtest package for recording structured log output during tests (#28)

v1.4.0

11 Nov 11:07

Choose a tag to compare

Improvements

  • Add flexibility to IsError() to support:
    • IsError("") matching any error
    • IsError(nil) matching no error
    • IsError(err) matching with errors.Is(),
    • IsError(<string>) matching errors whose message contains the string
    • IsError(<regexp>) matching errors whose message match the regular expression
  • Relax IsNotNil() to accept values of non-nillable types as not nil.
  • Add t.With() as an option to further qualify the test conditions

Code changes

  • Update CI, bump go min version to 1.19 (#23)
  • Fix CI on Windows runners (#24)
  • Add support for t.With(...) in BDD-style test structure (#25)
  • Relax implementation of .IsNotNil() to return true for any value of a non-nillable type (#26)
  • Make .IsError(...) more flexible (#27)

Related issues

  • BDD style given-when-then could benefit from a "with" clause (#22)
  • IsNotNil() predicate is too strict (#20)
  • .IsError(...) predicate could be more flexible (#21)

v1.3.0

20 Nov 03:04
1851165

Choose a tag to compare

Improvements

  • Add .AsError() as a transformation for testing against a specific error
    types and accessing specific fields in the target type.
  • Add message: output for errors, printing out the formatted error message.

v1.2.1

09 Oct 19:21
c1d3fba

Choose a tag to compare

Bug fix

  • Fix crash in output formatting code caused by string wrapping logic in deeply
    nested cases where target width decreases to 0 or below.

Improvements

  • Add MinWidth formatting option to preserve reasonable formatting even with
    deeply indented values, default to 40 for test output
  • Fix indentation in README code samples

v1.2.0

08 Oct 07:06
e871994

Choose a tag to compare

Major Changes

  • Add support for recording un-evaluated predicates in table driven tests.
  • Reorganize packages hierarchy, removing internal and keeping only API-level
    packages at the top level under pkg.
  • Add .Passes() to evaluate sub-expression predicate on single value.

Improvements

  • .IsError() prints out string version of the error for readability.
  • .IsError(nil) provides better description when testing for no error.

v1.1.1

02 Oct 18:08
21801e6

Choose a tag to compare

Improvements

  • Fix code completion hints to make bdd.T usage seamlessly equivalent to
    testing.T -- testing functions prototype argument renamed to t instead of
    b.

v1.1.0

21 Sep 05:17
926e941

Choose a tag to compare

Major Changes

  • Add bdd sub-package to support BDD-style bifurcated execution of nested test
    sections.

v1.0.1

10 Sep 07:07
af3ea2b

Choose a tag to compare

v1.0.0

10 Sep 06:34
e855b62

Choose a tag to compare

Major Changes

  • Remove old deprecated API. Use verify.That() / require.That().
  • Reduce external dependencies to preserve go 1.14 compatibility

v0.6.4

06 Sep 20:38
64052fe

Choose a tag to compare

Changes

  • Add ability to record context key-value pairs with additional arguments to
    verify.That() / require.That().
    require.That(t, re.MatchString(tc.match),
      require.Context{Name: "re", Value: re.String()},
      require.Context{Name: "match", Value: tc.match},
    ).IsTrue()