testify
testify copied to clipboard
A toolkit with common assertions and mocks that plays nicely with the standard library
When I run my tests via Bazel, after the 1.8.0 change where `CallerInfo` displays the full path to the terminal I now get quite spammy outputs. Looks to be from...
## Summary This PR aims to fix #1236. While it's not the pretties fix, it avoids panic ## Changes Within `Unset` function instead of iterating over an slice and removing...
## Summary In order to fix JSON-unmarshalled comparison (https://github.com/stretchr/testify/issues/1160), we've added a new function `TimeEqual()` that compares timestamps instead of `time.Time` fields. This also allows you to compare times with...
## Summary Colorizes `error`, `expected`, `actual`, `test` name and `message` of the assert failure cases for better visualization. ## Changes 1. Colorizing changes in assert package as per #946 2....
I know this is probably a breaking change but I have some tests written using table driven design. I'd like for the tests ran with `suite.Run(name string, func(){})` to also...
Minimal test case: ``` package testifyrepro import ( "testing" "github.com/stretchr/testify/assert" ) func TestReflect(t *testing.T) { type s struct { f map[[1]byte]int } v1 := s{ f: map[[1]byte]int{ [1]byte{0x1}: 0, [1]byte{0x2}:...
## Summary This PR fixes #997 In most go libraries nowadays (etcd, kubernets, aws, etc.) the [functional options pattern](https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis) is being used: ```go c := client.New(client.WithTimeout(), client.WithLabel("bar")) ``` ```go type...
It seems the map is rendered with no trailing `,` for the last element, so the diff catches that as a modified line.. but really the line isn't modified.. ```...
## Summary The attempt to fix a legitimate go vet finding (https://github.com/stretchr/testify/commit/b5ce16571001d6e96e1693ac891fed5c2510c651) breaks the referenced deprecated use case in v1.8.0. This vet finding can't be fixed until v2. The mutex...
Upgrading from v1.7.1 to v1.8.0 results in this for my tests which call `AssertExpectationsForObjects`: ``` mock.Mock is not mock.assertExpectationser: missing method AssertExpectations ``` Called like this: ``` mock.AssertExpectationsForObjects(t, someRepository.Mock, otherRepository.Mock)...