concrete-eth / concrete-geth

Concrete is a framework for building application-specific rollups on the OP Stack
GNU Lesser General Public License v3.0
47 stars 19 forks source link

Feat/cli test #28

Closed therealbytes closed 11 months ago

therealbytes commented 11 months ago

Add a basic tool to run End-to-End tests written in Solidity.

Every contract in the designated testing directory will be treated as a test. The setUp, test, and testFail keywords are supported and have the same functionality as they do in foundry's forge.

contract Test {
    // setUp: An function invoked before each test case is run.
    // It is not optional but it should be.
    function setUp() external {
        return;
    }

    // test: Functions prefixed with test are run as a test case.
    // This will pass.
    function testSuccess() external {
        return;
    }

    // testFail: The inverse of the test prefix - if the function does not revert, the test fails.
    // This will pass.
    function testFailure() external {
        revert();
    }
}