Testing

To ensure your FlareScript code works as expected, you can write tests using Rust's testing framework (since the compiler is written in Rust).

Example Test:

#[test]
fn test_max_function() {
    let code = r#"
    function max(a: uint256, b: uint256): uint256 {
        if (a > b) {
            return a;
        } else {
            return b;
        }
    }
    "#;

    let tokens = tokenize(code).unwrap();
    let ast = parse(tokens);

    // Assertions to verify the AST structure
}

Last updated