Foundry test: introduction

This commit is contained in:
David E. Perez Negron R 2023-08-19 21:44:09 -06:00
parent 1192ad6462
commit 3208f88328
2 changed files with 26 additions and 0 deletions

5
src/HelloWorld.sol Normal file
View File

@ -0,0 +1,5 @@
pragma solidity ^0.8.20;
contract HelloWorld {
string public greet = "Hello World!";
}

21
test/HelloWorld.t.sol Normal file
View File

@ -0,0 +1,21 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {Test, console2} from "forge-std/Test.sol";
import {HelloWorld} from "../src/HelloWorld.sol";
contract CounterTest is Test {
HelloWorld public helloWorld;
function setUp() public {
helloWorld = new HelloWorld();
}
function testGreet() public {
assertEq(
helloWorld.greet(),
"Hello World!"
);
}
}