Skip to content

Releases: JosiahWitt/ensure

Add Contains chainer and others!

02 Apr 03:45
61c6552
Compare
Choose a tag to compare

Adds the following chainers:

  • Contains - allows checking if a string, list, or array contains something
  • DoesNotContain - allows checking if a string, list, or array does not contain something
  • IsNotNil - to use when you need to ensure something isn't nil
  • IsNotEmpty - to use when you need to ensure something isn't empty

Minor changes to match CLI release

16 Mar 03:30
063501b
Compare
Choose a tag to compare

Updates references in this package to match changes from the Ensure CLI v0.1.4 release.

Pretty print actual and expected

26 Feb 03:20
824dc5e
Compare
Choose a tag to compare

Actual and expected are now pretty printed when they are not equal. Strings are quoted, so their formatting doesn't impact the test output. These changes make it easier to tell why a particular equality test is failing.

NEW mock features

04 Feb 01:59
b3ed38e
Compare
Choose a tag to compare

Adds the following features to mocks:

  • Supports embedding structs in Mock struct for sharing groups of mocks between tests (#30)
  • Allows defining the NEW method without parameters for building simple pass-through mocks (#31)
  • Allows tagging mock fields to be ignored if unused (#32)

See the example in the README for usage.

Support mocks in table driven tests

02 Feb 02:52
7f15b96
Compare
Choose a tag to compare

Mocks are now supported in table driven tests. See the README for an example.

Interface polish with small breaking changes

19 Jan 00:55
30a5844
Compare
Choose a tag to compare

Breaking changes:

  • Requires Go 1.14+

  • Removes Fail() method, and replaces it with Failf(<msg>)

  • Everything now uses Fatalf instead of Errorf, so tests fail immediately if something goes wrong

  • Fails tests if ensure(...) is called and is missing chained assertions. For example:

    ensure(true) // Fails

Add IsEmpty() chained method

15 Jan 02:54
bb2d171
Compare
Choose a tag to compare

Now supports checking for empty arrays, slices, strings, and maps with IsEmpty(). For example:

ensure([]string{}).IsEmpty()

Fix using imported package and add IsNil()

14 Jan 03:05
a336489
Compare
Choose a tag to compare

Now importing the package should not panic. Adds IsNil() chained method.

Fix import errors

14 Jan 02:38
8f858e0
Compare
Choose a tag to compare

Not committing the mocks caused package import errors.

Initial Release

14 Jan 02:22
aba8231
Compare
Choose a tag to compare

Support for basic testing.