- generics are used where possible
- meaningful diffs instead of bunch of lines(that is
git-diff(actual, expected)
) somewhere from values string representations, tree diffs are used instead, so you can see exactly where values do not match - in unequal strings unprintable characters are escaped appropriately
- less dependencies than
stretchr/testify
- fixtures api: use test resources and have them destroyed automatically:
- env vars
- file content
- parsed json
- temp file
- temp dir
io.Reader
contents
- power assert
- no api mirroring for
assert
ing orrequire
-ing and failing immediately after check - golden files support
- pretty and colourful test output
- no
Expect(ACTUAL).To(Equal(EXPECTED))
nonsense rewriting of simpleACTUAL == EXPECTED
, just useassert.Equal(t, ACTUAL, EXPECTED)
orassert.Assert(t, ACTUAL == EXPECTED)
and see values used in case of failure (dark magic inside)
features | rprtr258/assert | stretchr/testify | shoenig/test | alecthomas/assert |
---|---|---|---|---|
minimal dependencies | ✅ | ❌ | ✅ | ✅ |
generics | ✅ | ❌ | ✅ | ✅ |
meaningful diffs | ✅ | ❌ | ✅ | ❓ |
power assert | ✅ | ❌ | ❌ | ❌ |
fixtures | ✅ | ❌ | ✅1 | ❌ |
no api mirroring | ✅ | ❌ | ❌ | ✅ |
golden files support | ✅ | ❌ | ❌ | ❌ |
Footnotes
-
temp file and port only ↩