Skip to content
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

Switch from try-catch test block to low-level call and assert the exact output #655

Open
aaronbuchwald opened this issue May 23, 2023 · 0 comments
Labels
good first issue Good for newcomers

Comments

@aaronbuchwald
Copy link
Collaborator

Follow up from #601 (comment)

Using a try-catch block does not check the exact reason for failure. To be more specific about the expected behavior, we can use a low-level call that returns the return data and a boolean to indicate success/failure directly.

(bool success, bytes memory ret) = address(c).call(abi.encodeWithSignature("foo()"));
require(!success);
require(ret.length == 0, "ret length unexpected length");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Archived in project
Status: Backlog 🗄
Development

No branches or pull requests

2 participants