testify
testify copied to clipboard
A toolkit with common assertions and mocks that plays nicely with the standard library
Mock.IsMethodCallable implements its own incomplete expected argument checking. So it doesn't always work. It should be using the same methods as Mock.Called to check if it is callable. It also...
## Summary Improve the error message raised my AssertNumberOfCalls. This specify exactly what method mock is failing the test. ## Motivation When running my tests, I did not see any...
## Description If a test gets skipped in SetupTest() in a suite that implements WithStats, the suite will panic on shutdown. ## Step To Reproduce ``` package main import (...
## Summary This fixes issue #1722. ## Changes Prevent stats.end() if stats.start() never ran. ## Motivation Allow skipping a test in a setup/before hook. See issue #1722 for an example....
## Summary Adds `RunWithReturn` which is essentially `Run` but adds `Arguments` as the return type and propagates them. Used this as a starting point https://github.com/stretchr/testify/pull/742 ## Changes - Adds `RunWithReturn`...
Testify uses the yaml package provided by https://github.com/go-yaml/yaml. After no development for a long period, a few days ago it finally got archived. Testify should migrate to another yaml package...
## Description When using `assert.Contains` on byte slices, the assertion fails even if the expected subsequence exists. Environment: - Go version: 1.23 - Testify version: v1.10.0 ## Step To Reproduce...
Functions that computes mock return arguments based on input arguments. Example: mocking a `io.Write` function: ```go mf := mocks.RemoteFile{} mf.On("Close").Return(tt.sftpErrorFileClose) mf.On("Write", mock.AnythingOfType("[]uint8")).Return( func(input []byte) int { return len(input)}, tt.sftpErrorFileWrite) ```
## Description I'm trying to implement some custom assertions as part of a test double. I've tried to follow along with the pattern where t.Helper() is called to register my...
## Description Mock.MethodCalled calls Mock.mutex.Lock. Then, it calls Mock.findExpectedCall which searches the Mock's list of expected calls. When it comes across a potential match, it calls Diff on the arguments....