Skip to content

feat: add Captor matcher for argument inspection#301

Draft
kliukovkin wants to merge 1 commit into
uber-go:mainfrom
kliukovkin:feat/captor
Draft

feat: add Captor matcher for argument inspection#301
kliukovkin wants to merge 1 commit into
uber-go:mainfrom
kliukovkin:feat/captor

Conversation

@kliukovkin
Copy link
Copy Markdown
Contributor

Implementation for #300.

Open for design discussion on the issue first; this PR provides a concrete reference. Will mark ready for review once the issue gets ack.

cc @sywhang @r-hang @abhinav

Captor[T] is a generic Matcher that records arguments passed to a
mocked method so tests can inspect them after the run, without writing
a Do callback that mirrors the full method signature. Wrong-type values
do not match and are not recorded, so it composes with AnyOf and
similar matchers. Captures are guarded by a mutex for use with mock
calls from multiple goroutines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant