186 Commits

Author SHA1 Message Date
Olivier Mengué
8b3dc18b37 mock: enable parallel testing on internal testsuite
Add t.Parallel() to all package-level tests of the 'mock' package.
Result: faster tests results.

Before:
  $ go test -count=10 ./mock
  ok  	github.com/stretchr/testify/mock	0.631s
After:
  $ go test -count=10 ./mock
  ok  	github.com/stretchr/testify/mock	0.426s
2025-05-30 17:12:36 +02:00
Olivier Mengué
e2ad95950e mock/tests: add method Helper() to all mock of *testing.T 2025-05-25 21:56:50 +02:00
Bracken
a31a53e5b4
Merge pull request #1615 from DevotedHealth/mauclair-mock-match-sprintf
Lazily render mock diff output on successful match
2025-05-06 11:20:15 +01:00
Mike Auclair
e6575e05ed
Update mock.go 2025-03-24 14:24:41 -04:00
Bracken
c3915e850a
Merge branch 'master' into refactor/simplify-with-sprintf-q 2025-03-23 14:22:18 +01:00
Bracken
1e7fb5865a
Merge pull request #1709 from techfg/chore/issue-1621-update-docs
chore: update docs for Unset #1621
2025-03-22 12:44:25 +01:00
techfg
c6ac9bb91d chore: update per PR feedback 2025-03-21 06:25:01 -07:00
Grégoire Paris
b1c9368f81
Improve existing docs 2025-03-21 13:21:25 +01:00
Grégoire Paris
89086b0757
Document consequences of calling t.FailNow()
These comments are adapted from t.FailNow()'s own documentation.

Closes #1701
2025-03-19 20:50:44 +01:00
techfg
098128fd10 chore: update docs for Unset #1621 2025-03-18 12:48:09 -07:00
Mike Auclair
cbf6e73c7e simplified renderers 2024-12-17 18:30:48 +00:00
Mike Auclair
3d98e693c7 cleanup 2024-12-17 18:25:59 +00:00
Oleksandr Redko
30f3cef5ad Apply suggestions from code review
Co-authored-by: Olivier Mengué <dolmen@cpan.org>
2024-12-10 14:08:46 +02:00
Oleksandr Redko
d57bac8721 refactor: use %q to simplify fmt.Sprintf 2024-11-24 18:28:03 +02:00
Bracken
89cbdd9e7b
Merge pull request #1626 from arjun-1/fix-functional-options-diff-indirect-calls
fix: compare functional option names for indirect calls
2024-11-12 22:58:45 +00:00
sikehish
716de8dff4 Increase timeouts in Test_Mock_Called_blocks to reduce flakiness in CI 2024-10-29 00:00:56 +05:30
Arjun Dhawan
7d99b2b43d attempt 2 2024-10-27 08:07:57 +01:00
Arjun Dhawan
05f87c0160 more similar 2024-10-27 08:05:00 +01:00
Arjun Dhawan
ea7129e006 better fmt 2024-10-27 08:02:53 +01:00
Arjun Dhawan
be992afabf trial 2024-10-24 13:28:30 +02:00
Arjun Dhawan
fb67df6392 no regression 2024-10-24 11:40:45 +02:00
Arjun Dhawan
55bac84354 reword tests 2024-10-24 11:30:00 +02:00
Arjun Dhawan
822223ec34 fix name regression 2024-10-24 11:30:00 +02:00
Arjun Dhawan
22d3bd5def in order to remain compatible with go1..19, don't compare function names (but do include them in the diff output) 2024-10-24 11:30:00 +02:00
Arjun Dhawan
9c174eb41c fix: compare functional option names for indirect calls
Closes Functional Options testing broken for indirect calls #1380
2024-10-24 11:30:00 +02:00
Bracken
a012e45d18
Merge pull request #1636 from rainhq/jayd3e.fix_return_arguments
Record Return Arguments of a Call
2024-10-16 14:07:58 +01:00
Oleksandr Redko
ba3e7c34d5 mock: fix doc comment for NotBefore 2024-10-04 18:06:40 +03:00
Bracken
85a526818c
Merge branch 'master' into master 2024-10-02 17:21:55 +01:00
Spirin
f3f7181b01
Merge branch 'master' into unexpected-method-caller-info 2024-10-01 02:22:07 +03:00
spirin
d62ca68bf5 tests 2024-10-01 02:21:38 +03:00
Bracken
72e3b61028
Merge branch 'master' into mock-simplify-FunctionalOptions-impl 2024-09-30 23:28:38 +01:00
spirin
ea6964c2e9 mock: caller information for unexpected method call 2024-09-30 21:33:46 +03:00
Reynier Ortiz
f17409f81f mock: in order mock calls
(requested changes applied)
2024-09-25 12:03:55 -04:00
Reynier Ortiz
bdb1271ed8 mock: in order mock calls 2024-09-25 11:26:01 -04:00
Reynier Ortiz
7268a5bc0b mock: in order mock calls 2024-09-06 09:18:07 -04:00
Joseph Dallago
da63673a11
Now properly record the ReturnArguments as part of the call. 2024-08-29 22:05:04 +03:00
Mike Auclair
2b53603313 wip 2024-06-25 14:59:20 +00:00
Mike Auclair
dd725333f3 wip 2024-06-24 20:29:26 +00:00
Bracken
8d4dcbbccb
Merge pull request #1569 from stretchr/mock-more-AnythingOfTypeArgument-alternatives
mock: document more alternatives to deprecated AnythingOfTypeArgument
2024-04-23 16:15:28 +00:00
Olivier Mengué
8c324a0bbd
mock: simpler deprecation doc for AnythingOfTypeArgument
Co-authored-by: Bracken <abdawson@gmail.com>
2024-04-23 15:23:21 +02:00
Olivier Mengué
d4a63f5b89 mock: simplify implementation of FunctionalOptions
Remove unnecessary use of reflect in the implementation of
mock.FunctionalOptions().
2024-04-22 23:10:37 +02:00
Snir Yehuda
da1e1476cb
Merge branch 'master' into master 2024-03-18 09:47:57 +02:00
Olivier Mengué
3c302f75ae
mock: improve doc (#1570)
## Summary
Improve API doc of package
[`mock`](https://pkg.go.dev/github.com/stretchr/testify/mock):
- add godoc links
- indent example code

## Motivation
Readability.
2024-03-10 11:42:04 +01:00
Olivier Mengué
aca1890ec1 mock: document more alternatives to deprecated AnythingOfTypeArgument 2024-03-07 11:59:12 +01:00
Snir Yehuda
f1b5324b90 assert.FunctionalOptions: fix go doc 2024-03-06 11:28:50 +03:00
Tom Wright
cab2acc70f Do not get argument again unnecessarily in Arguments.Error() 2024-03-06 03:03:10 +01:00
Bracken
c719de3088
Merge pull request #1331 from ianrose14/ianrose/assertexpectations-skipped
Ensure AssertExpectations does not fail in skipped tests
2024-02-17 17:50:13 +00:00
Sean Marciniak
648a7937c5
Merge pull request #1416 from stretchr/mock-simplify-matcher-check
mock: optimize argument matching checks
2024-01-22 08:48:09 +10:30
Sean Marciniak
24e57f1a77
Merge pull request #1444 from stretchr/mock-refactor-TestIsArgsEqual
mock: refactor TestIsArgsEqual
2024-01-22 08:44:43 +10:30
Ian Rose
1837f62a5f Ensure AssertExpectations does not fail in skipped tests 2023-10-31 00:00:55 +01:00