Created
March 17, 2020 08:17
-
-
Save alexroan/d62dc2a86358b143e7777f19f68c4995 to your computer and use it in GitHub Desktop.
truffle-smart-contract/TestHelloWorld.sol/0.0.5
This file contains hidden or 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
pragma solidity >=0.5.0; | |
import "truffle/Assert.sol"; | |
import "truffle/DeployedAddresses.sol"; | |
import "../contracts/HelloWorld.sol"; | |
contract TestHelloWorld { | |
function testItGreets() public { | |
// Get the deployed contract | |
HelloWorld helloWorld = HelloWorld(DeployedAddresses.HelloWorld()); | |
// Call getGreeting function in deployed contract | |
string memory greeting = helloWorld.getGreeting(); | |
// Assert that the function returns the correct greeting | |
Assert.equal(greeting, "Hello World", "It should greet me with Hello World."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment