Commit Graph

877 Commits (suite-1501-fix-TestSubtestPanic)

Author SHA1 Message Date
Olivier Mengué 686805796c suite: fix TestSubtestPanic failure (#1501)
The subtest of TestSubtestPanic is expected to fail, but that must not
make the testuite of package 'suite' to fail. So call Skip to make 'go
test' to ignore that expected failure.
2023-11-01 23:08:01 +01:00
Craig Davison 331c520966 Improve readability 2023-10-31 15:54:18 +01:00
Craig Davison 5f48c62606 address some review comments 2023-10-31 15:54:18 +01:00
Craig Davison b7c378d6bd captureTestingT.checkResultAndErrMsg 2023-10-31 15:54:18 +01:00
Craig Davison 002647e9f8 TestErrorIs/TestNotErrorIs: check error contents 2023-10-31 15:54:18 +01:00
Justin Chadwell 5105b61304 Add map support doc comments to Subset and NotSubset
Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-10-31 00:24:17 +01:00
Oleksandr Redko 43b2ef12b3 Change to use godoc 2023-10-31 00:07:12 +01:00
Oleksandr Redko 056e9e6bfa docs: Fix deprecation formatting for http 2023-10-31 00:07:12 +01:00
Linus Barth 7df1a82a31 test: add suite tests for panicking of subtests 2023-10-30 22:51:08 +01:00
Linus Barth a4a54a4597 fix: panic behavior for subtests
This fix adds panic handling for subtests which will achieve:
- subtests will fail for the correct test context when panicking
- the test execution is not stopped; the next subtest will be executed
2023-10-30 22:51:08 +01:00
Linus Barth 65318c364a improve: tests for asserting test names in subtests 2023-10-30 22:51:08 +01:00
Linus Barth 130d340262 improve: move comment to msgAndArgs-param in test 2023-10-30 22:51:08 +01:00
Linus Barth 855d1c6784 test: testing.T correctness in subtests setup/teardown 2023-10-30 22:51:08 +01:00
Linus Barth 82022eeb0d test: call order of setup/teardown for subtests 2023-10-30 22:51:08 +01:00
Linus Barth 4526456fa4 improve: defer-style in Suite.Run() 2023-10-30 22:51:08 +01:00
Linus Barth 737a765d89 fix: SetupSubTest and TearDownSubTest execution order
There were two problems with the order of execution in the Suite.Run() method:
- One could not access the correct testing context ("s.T()") inside the SetupSubTest and TearDownSubTest methods. If the testing context was used for e.g. assertions of mocks in the TearDownSubTest, the results would not be "attached" to the correct test in the test output.
- The behavior was different to the order of execution for "root" tests (see lines 167-201) regarding the SetupTest and TearDownTest methods. This could confuse users of the library.

Also the logic to be deferred was joined together. This was fine beforehand because a panic in the TearDownSubTest would have had no influence on the "suite.SetT(oldT)". Now since a panic in the TearDownSubTest would lead to omitting the "suite.SetT(oldT)" this defer was split into two separate defers.
2023-10-30 22:51:08 +01:00
Oleksandr Redko 351d2776c6 Revert some changes 2023-10-30 22:41:11 +01:00
Oleksandr Redko 375474cd3c suite: refactor test assertions 2023-10-30 22:41:11 +01:00
Harald Nordgren fc1dee9921 Deprecate EqualExportedValues 2023-10-24 09:21:34 +02:00
Kevin Burke 7f962d56e4 .github: use latest Go versions
Also update the runners to their latest versions.
2023-10-24 09:10:36 +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