Replies: 4 comments 6 replies
-
Btw. is this the wrong place to discuss that? Should I open an issue in forge-std? |
Beta Was this translation helpful? Give feedback.
-
That would imply all calls would get pranked by default which is definitely not desireable. I think the current separation is fine, although it might have been more clear if we had called it
No this is the correct place |
Beta Was this translation helpful? Give feedback.
-
Maybe this is something that can be solved better with IDE syntax highlighting explcitly highlighting the context of the call if it's pranked. |
Beta Was this translation helpful? Give feedback.
-
Contuining our test migration from the same test case this morning... I still think that the behavior is non-intuitive. I also surveyed one of my colleagues (who has never used dapptools or foundry before) how he expects this to work: he intuitively also assumed it would basically apply to the whole line afterwards at least. Although more verbose, I think I'd find a stack-based prank state API more intuitive and easier to follow when reading a test. E.g. one where you not only And when looking at a few lines where you In other languages, I'd have probably expected this API to use some kind of closure syntax
Obviously we can't do that here. But the closes to that would be a I know that this feedback is super late and it's probably not actionable at this point but and it makes sense to stay in-line with DappTools but maybe this can be added in addition. I'd love to hear what others think about this concern after trying to "take a step back" and evaluating the intuitiveness of it with a fresh and unbiased look at it. |
Beta Was this translation helpful? Give feedback.
-
I find myself making the same mistake over and over again ... Previously I've been using
prank
a lot instead ofstartPrank
but due to this, I'm wondering if I should exclusively usestartPrank
. Here's why:At first glance,
prank
seems great. Single line, just applies to the next call, no need to undo afterwards, etc. ... However, what if the next line afterprank
looks like this:I don't know if I'm alone with this, but I keep running into this:
prank
in this case just applies to the creation ofOtherContract
, notthe actual call to
setSomething
.It's probably a bit late for a change here but I wonder if it would be better to default
prank
to behave likestartPrank
and have aprankOnce
that explicitly only applies to the next instruction.The problem isn't that I'm not aware of
prank
only applying to the next instruction but rather that I constantly write these single-line double-instructions and am then confused why my test fails.Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions