Skip to content

Getting error while running foundry test #217

Answered by EngrPips
skpkss asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @skpkss, why dont you have a setUp function inside of the this test contract?

Your test is suppose to look like the below.

contract MyContractTest is Test {
MyContract exampleContract 

function setUp() public {
exampleContract = new MyContract();
}

function testIsAlwaysGetZero() public {
uint256 data = 0;
exampleContract.doStuff(data)
assert(exampleContract.shouldAlwaysBeZero == 0);
}
}

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
1 reply
@skpkss
Comment options

Comment options

You must be logged in to vote
12 replies
@skpkss
Comment options

@EngrPips
Comment options

Answer selected by skpkss
@skpkss
Comment options

@EngrPips
Comment options

@skpkss
Comment options

@EngrPips
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants