Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Add argument captorsΒ #262

Open
Open
@tylersammann

Description

@tylersammann

Description

I think it would be nice to build an ArgumentCaptor interface and argumentCaptor struct that extends Matcher through composition, but store the value of the arguments before the "match" step. Those argument values could then be retrieved for later assertions (very close to how Mockito's ArgumentCaptors work in Java) https://static.javadoc.io/org.mockito/mockito-core/2.6.9/org/mockito/ArgumentCaptor.html

Use Case

I recently ran into a situation where I wanted to write a test that asserted something about the contents of an argument (a slice of struct pointers) passed to a mocked method. Using matchers as they currently exist (i.e. eqMatcher), I couldn't find a good way to do that without already knowing the memory addresses of the pointers in the slice.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions