From 8ccddab0c2d99d894c05b26ca25f20aac5add5a9 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 14 Jul 2024 09:26:22 +0200 Subject: [PATCH] Added new function and test for it --- src/MyContract.sol | 10 ++++++++++ test/TestMyContract.t.sol | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/MyContract.sol create mode 100644 test/TestMyContract.t.sol diff --git a/src/MyContract.sol b/src/MyContract.sol new file mode 100644 index 0000000..1b27936 --- /dev/null +++ b/src/MyContract.sol @@ -0,0 +1,10 @@ +// src/MyContract.sol +pragma solidity ^0.8.0; + +contract MyContract { + // Existing functions and variables + + function newFunction() public pure returns (string memory) { + return "Hello, Farcaster!"; + } +} diff --git a/test/TestMyContract.t.sol b/test/TestMyContract.t.sol new file mode 100644 index 0000000..3871d96 --- /dev/null +++ b/test/TestMyContract.t.sol @@ -0,0 +1,18 @@ +// test/TestMyContract.t.sol +pragma solidity ^0.8.0; + +import "forge-std/Test.sol"; +import "../src/MyContract.sol"; + +contract TestMyContract is Test { + MyContract myContract; + + function setUp() public { + myContract = new MyContract(); + } + + function testNewFunction() public { + string memory result = myContract.newFunction(); + assertEq(result, "Hello, Farcaster!"); + } +}