Reduce calls to reflect.Type in implementation of mock.IsType by
extracting the type early.
This also avoids to keep alive references to the argument value.
Deprecate mock.AnythingOfTypeArgument which should never have been
publicly exposed.
AnythingOfTypeArgument is now a type alias to the private
anythingOfTypeArgument and is marked as Deprecated in godoc.
The AnythingOfType constructor is still available.
The aim is to completely remove that alias.
* EqualExportedValues: Handle pointer and slice fields
* Update assert/assertions.go
Co-authored-by: Michael Pu <michael.pu123@gmail.com>
* Reduce redundant calls to 'copyExportedFields'
* Update comments
* Add support for maps
* Update Go version support to 1.19 and onward
* Re-generate after rebasing
---------
Co-authored-by: Michael Pu <michael.pu123@gmail.com>
Unset changes len of a `ExpectedCalls` slice during iteration while using index from original slice, and under some conditions it tries to reslice element beyond of the slice boundaries. That causes panic.
The proposed solution uses independent write index to count elements kept in output slice.
Tests (the simplest and more complicated cases) and comments are included.
* impr: `CallerInfo` should print full paths to the terminal
I am proposing this simple change, which changes this output
```
--- FAIL: TestABC (0.00s)
--- FAIL: TestABC/C (0.00s)
/this/is/a/path/to/file_test.go:258:
Error Trace: file_test.go:258
file_test.go:748
Error: Not equal:
...
```
to this:
```
--- FAIL: TestABC (0.00s)
--- FAIL: TestABC/C (0.00s)
/this/is/a/path/to/file_test.go:258:
Error Trace: /this/is/a/path/to/file_test.go:258
/this/is/a/path/to/file_test.go:748
Error: Not equal:
...
```
With the latter output, it is much more straightforward to find the file
you are looking for, even though in the displayed case, the file is the same.
However, for VSCodium, the case is a little more helpful, since VSCodium's
terminal is smart enough to recognize the output, and make links out of that input.
Signed-off-by: Stavros Ntentos <133706+stdedos@users.noreply.github.com>
* test: fix the tests that depended on the previous behavior
Signed-off-by: Stavros Ntentos <133706+stdedos@users.noreply.github.com>
Co-authored-by: Stavros Ntentos <11300730-stavros-relex@users.noreply.gitlab.com>