Commit Graph

864 Commits (fix-1231-InEpsilonSlice-expected-actual-order)

Author SHA1 Message Date
Olivier Mengué f8dcfd6618 assert.InEpsilonSlice: mention index of error in fail message 2023-10-18 18:46:08 +02:00
Olivier Mengué 7d383ba732 assert.InEpsilonSlice: refactor 2023-10-18 18:46:08 +02:00
Olivier Mengué f7fbc7da15 assert.InEpsilonSlice: fix order of expected vs actual (#1231) 2023-10-18 18:46:08 +02:00
Olivier Mengué 8fd5aae061 assert.InEpsilonSlice: remove redundant check
Remove check of actual's kind redundant with Type()'s check.
2023-10-18 18:46:08 +02:00
Olivier Mengué f728d3c50f assert.InEpsilonSlice: refactor
Remove multiple calls to reflect.Value.Len()
2023-10-18 18:46:08 +02:00
Olivier Mengué b5dec80529 assert.InEpsilonSlice: add more slice checks 2023-10-18 18:46:08 +02:00
Olivier Mengué ab3b9743a7 assert.InEpsilonSlice: refactor 2023-10-18 18:46:08 +02:00
Zachary Becker 4ae48e988c Combine switch cases, difference wrapped in if statement 2023-10-16 00:55:57 +02:00
Zachary Becker 2f7efa2451 Fix bug where array is treated as slice in EqualExportedValues 2023-10-16 00:55:57 +02:00
hidu ce5c2b684b assert: fix httpCode and HTTPBody occur panic when http.Handler read body 2023-10-15 23:34:32 +02:00
Grzegorz Burzyński 89920137cd collect errors from condition in defer 2023-10-13 08:53:17 +02:00
Grzegorz Burzyński 4ed68e1bca fix: make EventuallyWithT concurrency safe 2023-10-13 08:53:17 +02:00
dependabot[bot] 11a6452626 Bump actions/setup-go from 3.2.0 to 4.1.0
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3.2.0 to 4.1.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v3.2.0...v4.1.0)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-10 17:30:50 +02:00
dependabot[bot] c1ca192909 Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-10 17:25:08 +02:00
tscales 34763e0df3 assert: ObjectsAreEqual: use time.Equal for time.Time type 2023-10-10 17:14:01 +02:00
Oleksandr Redko 1ee798c140 Remove canConvert because Go 1.16 is dropped from support 2023-10-10 14:28:34 +02:00
Olivier Mengué 882382d845
Merge pull request #1441 from stretchr/mock-deprecate-AnythingOfTypeArgument
mock: deprecate AnythingOfTypeArgument (#1434)
2023-08-08 11:46:46 +02:00
Olivier Mengué f24f3ba986 mock: deprecate AnythingOfTypeArgument (#1434)
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.
2023-08-08 11:05:09 +02:00
Olivier Mengué 0e90845e22
Merge pull request #1445 from stretchr/assert-refactor-getLen
assert: refactor internal func getLen()
2023-08-08 11:04:26 +02:00
Olivier Mengué 9e58631a03 assert: reverse return values of internal getLen()
Reverse order of return values of internal function getLen() to be more
consistent with stdlib (ex: os.LookupEnv).

Old: func (any) (ok bool, length int)
New: func (any) (length int, ok bool)
2023-08-08 11:01:35 +02:00
Olivier Mengué 7a796b8f87 assert: simplify getLen() implementation 2023-08-08 11:01:35 +02:00
Anant Vyas a23f5db224
mock: move regexp compilation outside of Called (#631)
Co-authored-by: Olivier Mengué <dolmen@cpan.org>
2023-08-01 10:07:29 +02:00
Ivan Pesenti a392378178 Fixed typos
"Setup" means an existing arrangeament while "set up" is an action.
2023-07-31 19:15:21 +02:00
Olivier Mengué 81667ad920 assert: fix flaky TestNeverTrue
Fix flaky TestNeverTrue: use a channel to make a synchronized list of
return values to avoid a race condition.
2023-07-31 19:06:57 +02:00
Olivier Mengué 862e41010c
Merge pull request #1360 from hikyaru-suzuki/feature/update_logging_output
mock: AssertExpectations log reason only on failure
2023-07-29 05:52:15 +02:00
Olivier Mengué 486eb6f08c
Merge pull request #1406 from dolmen-go/use-std-header-for-generated-code
codegen: use standard header for generated files
2023-07-22 08:51:09 +02:00
Olivier Mengué af4d8a66cf
Merge pull request #1320 from lesichkovm/patch-1
Fix adding ? when no values passed
2023-07-11 22:52:16 +02:00
Olivier Mengué 78aedbf433
Merge pull request #1409 from SuperQ/test_old_versions
CI: run tests from go1.17
2023-07-06 13:09:59 +02:00
SuperQ 95683d1a6c
Add tests for old Go versions
Test old Go versions all the way back to 1.17.

Signed-off-by: SuperQ <superq@gmail.com>
2023-07-06 12:59:57 +02:00
Olivier Mengué 0a3163c6c4
Merge pull request #1410 from alexandear/docs-fix-typos
doc: Fix typo in godoc

Also fix typos in tests (assertion messages).
2023-07-06 12:33:18 +02:00
Oleksandr Redko 37814a1755 docs: Fix typos in tests and comments 2023-07-06 13:14:39 +03:00
Olivier Mengué 34b86428f4
Merge pull request #1346 from LandonTClipp/mockery_docs
README: update mockery link to point to doc on Github Pages
2023-07-05 12:52:28 +02:00
Olivier Mengué 4f6e609334
Merge branch 'master' into mockery_docs 2023-07-05 12:49:36 +02:00
Olivier Mengué 204612911e
README: fix link to mockery tool 2023-07-05 12:48:13 +02:00
Olivier Mengué 6bfed73816
Merge pull request #1349 from davidjb/patch-1
README: fix URLs to point to go.dev/pkg.go.dev
2023-07-05 12:39:07 +02:00
Olivier Mengué c6ffad3f5c
Merge pull request #1389 from echarrod/master
Correct spelling/grammar in README and comments
2023-07-05 12:18:24 +02:00
Olivier Mengué b247874fc3
Merge pull request #1367 from stretchr/mvdkleijn-patch-1
Remove mvdkleijn from MAINTAINERS.md on his request
2023-07-05 12:01:22 +02:00
Olivier Mengué 945f91b9b9
Merge pull request #1392 from programmer04/improve-docs
Document that require is not safe to call in created goroutines
2023-07-05 11:59:09 +02:00
Olivier Mengué 68bbf7ae46
Merge pull request #1394 from SuperQ/go_min
Set Go version to 1.19 (oldstable) in go.mod
2023-07-05 11:57:03 +02:00
Olivier Mengué 5ca0755b51 codegen: use standard header for generated files
Use the standard header in generated Go sources.
See https://go.dev/s/generatedcode.
2023-07-02 21:06:15 +02:00
SuperQ b5eddf779a
Fix Go modules version
The `go` directive in go.mod is meant to indicate the minimum supported
version.

See: https://go.dev/doc/modules/gomod-ref#go

Signed-off-by: SuperQ <superq@gmail.com>
2023-06-02 16:11:11 +02:00
Jakub Warczarek e18a70d446
Document that require is not safe to call in created goroutines 2023-05-31 11:34:43 +02:00
Martti T f97607b898
Create GitHub release when new release tag is pushed (#1354) 2023-05-30 19:38:40 +10:00
Ed 9f0f17fe64 Correct spelling/grammar 2023-05-26 10:38:59 +01:00
Harald Nordgren 4c93d8f201
EqualExportedValues: Handle nested pointer, slice and map fields (#1379)
* 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>
2023-05-11 07:42:04 +10:00
Tobias Krischer 4b2f4d2bcf
add EventuallyWithT assertion (#1264)
* add EventuallyWithT assertion

* Change "EventuallyWithT" condition acceptance to no-errors raised

This change updates the "EventuallyWithT" assertion variants (regular, formatted,
requirement) to consider a condition as "met" if no assertion errors were raised
in a tick.

This allows to write easier conditions which simply contain assertions, without
needing to return a bool. The equivalent of a condition returning true in the
previous implementation would be a a condition with a single "assert.True(..)" call.

* Declare the "Collect.Copy(T)" method as a testing helper

* run go generate

---------

Co-authored-by: Arik Kfir <arik@kfirs.com>
2023-05-10 06:58:49 +10:00
Nisheeth Barthwal b3106d772c
allow testing for functional options (#1023)
* allow testing for functional options

* add linting docs

* use reflect magic to obtain FunctionalOption name

Co-authored-by: dillonstreator <dillonstreator@gmail.com>

---------

Co-authored-by: dillonstreator <dillonstreator@gmail.com>
2023-05-10 06:55:48 +10:00
wwade 437071b948
assert: fix error message formatting for NotContains (#1362)
* assert: rename and refactor TestContainsFailMessage

I've renamed it to TestContainsNotContains and added a test case
structure so that I can use this test to validate the failure messages
from both Contains and NotContains,

There are no functional changes here, strictly refactoring. A new test
case will be added in a subsequent change.

* assert: fix error message formatting for NotContains

It was using "%s" to format the s and contains arguments, but these
could be any type that supports iteration such as a map. In this case
of NotContains failing against a map, it would print something like:

   "map[one:%!s(int=1)]" should not contain "one"

Fix this using "%#v" as was already done for Contains and added test
cases covering both the "len()" / iterable failure messages as well as
the Contains/NotContains failure case.

The new message for this example map would be something like:

    map[string]int{"one":1} should not contain "one"
2023-05-05 14:05:51 +10:00
Martijn 02647d3471
Remove myself from MAINTAINERS.md
As I am supposed to be a maintainer but have almost zero access to actually manage the project, I've found it difficult to help out. Since then my time has become fragmented and as such I'm removing myself as maintainer.
2023-04-07 08:55:49 +02:00
Michael Pu c5fc9d6b6b
Compare public elements of struct (#1309)
* Implement checking only exported fields

Co-authored-by: Anthony Chang <anthony-chang@users.noreply.github.com>

* Update comment

* Run go generate

* Make compatiable with Go 1.16.5

* Fix go generate files

* Fix white space changes

* Fix whitespace changes

* Fix whitespace changes in gogenerate files

---------

Co-authored-by: Anthony Chang <anthony-chang@users.noreply.github.com>
2023-03-14 22:01:35 +10:00