-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make some of internal API public so that other crates can build on top of mockall #318
Comments
Can you give an example of how you would use |
I suppose I'd use it the same way it is used by the generated code. I.e., my struct that represents mocked contract will have |
To help me understand, could you provide a code sample, even one that doesn't compile? |
Sorry, was away for some time. Here's an example of our crate's API when used with sequences: https://github.com/gnosis/ethcontract-rs/blob/main/ethcontract-mock/src/test/mod.rs#L118 Specifically, we save mockall's sequence in our code, then we verify and satisfy it when contract methods are called. |
It looks like you've reimplemented almost all of Mockall, keeping only |
I mean, not exactly. I've manually implemented the same code for smart contracts that mockall would generate for traits and structs. Thus, it uses this semi-public API for generated code. And I'd like it to be interoperable with mockall's |
What is the point of reimplementing all of Mockall's generated code, anyway? Are you trying to mix calls to the same Sequence objects from both generated code and your own custom code? |
Yes, that's exactly what I'm doing. |
TLDR: I'm writing a crate that will allow mocking ethereum smart contracts, and I want it to work nicely with
mockall
. For that, I'd like to request makingSeqHandle
a part of official public API.Longer explanation.
So, ethereum contracts are like structs (with data and methods) that live in a blockchain. I'm writing a crate that will allow mocking them without using an actual chain. The idea is that you create a mock blockchain and deploy mock contracts onto it. When you deploy a contract, you get an object for setting up expectations. Since we use
mockall
quite extensively in our projects, I've decided to mirror its API in this object:Now I want to implement
in_sequence
, and I want it to work withmockall
's nativeSeqHandle
. This will allow creating sequences that combine calls to contracts and to normal mocked traits and functions.The text was updated successfully, but these errors were encountered: