The tests in CheatCodes.sol passed, however the test below fails. Tagging @onbjerg here since you implemented this feature originally in #403
pragma solidity 0.8.10;
import "ds-test/test.sol";
interface Vm {
function mockCall(address,bytes calldata,bytes calldata) external;
}
contract MyContract {
function outer() public returns (uint256) {
return inner();
}
function inner() public returns (uint256) {
return 5;
}
}
contract MyContractTest is DSTest {
MyContract c;
Vm vm = Vm(address(bytes20(uint160(uint256(keccak256('hevm cheat code'))))));
function testMock() public {
c = new MyContract();
assertEq(c.inner(), 5);
assertEq(c.outer(), 5);
uint256 _newVal = 10;
vm.mockCall(address(c), abi.encodeWithSelector(c.inner.selector), abi.encode(_newVal));
assertEq(c.inner(), _newVal); // passes
assertEq(c.outer(), _newVal); // fails
}
}
The tests in
CheatCodes.solpassed, however the test below fails. Tagging @onbjerg here since you implemented this feature originally in #403