Skip to content

Conversation

@Tudmotu
Copy link
Contributor

@Tudmotu Tudmotu commented Oct 4, 2024

Documentation for vm.mockCalls, see foundry-rs/foundry#9024.

@Tudmotu Tudmotu marked this pull request as ready for review October 7, 2024 14:14
@Tudmotu Tudmotu changed the title [Draft] Document vm.mockCalls Document vm.mockCalls Oct 7, 2024
// Calldata can either be strict or a partial match, e.g. if you only
// pass a Solidity selector to the expected calldata, then the entire Solidity
// function will be mocked.
function mockCalls(address, bytes calldata, bytes[] calldata) external;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the version with uint256 msgValue should also be added, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not sure, since the mockCall with msgValue is not included. By I can include it if you think it should be documented. In that case I should probably add it for mockCall as well?

Copy link
Contributor Author

@Tudmotu Tudmotu Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added both mockCall and mockCalls with msg.value, lmk if is ok.

> will receive the last `retdata` element in response. `clearMockedCalls` can be
> called to clear the mock
### Examples
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also have an example that uses the version with uint256 msgValue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add and update you

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an example with msg.value

@Evalir
Copy link
Member

Evalir commented Oct 22, 2024

deferring to @mattsse / @DaniPopes for merge.

@mattsse mattsse merged commit 42da808 into foundry-rs:master Oct 30, 2024
1 check passed
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.

3 participants