Created
June 26, 2022 18:47
-
-
Save dabit3/bcd6632400878266c792a41627964ea6 to your computer and use it in GitHub Desktop.
Testing calling another contract with Foundry / Solidity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.13; | |
import "forge-std/Test.sol"; | |
import 'src/Call.sol'; | |
contract AuctionTest is Test { | |
Call callContract; | |
TestCall tCallContract; | |
function setUp() public { | |
tCallContract = new TestCall(); | |
callContract = new Call(); | |
} | |
function testCall() public { | |
vm.expectCall( | |
address(tCallContract), | |
abi.encodeWithSignature("foo(string, uint256)", "call foo", 123) | |
); | |
callContract.callFoo(address(tCallContract)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment