#solidity #tree #syntax-tree #tree-structure #ast #cli

bulloak-foundry

A Solidity test generator based on the Branching Tree Technique

1 unstable release

0.8.0 Jul 27, 2024

#487 in Programming languages

Download history 98/week @ 2024-07-22 39/week @ 2024-07-29 5/week @ 2024-08-05 22/week @ 2024-08-12 15/week @ 2024-08-19 1/week @ 2024-08-26 5/week @ 2024-09-02 27/week @ 2024-09-16 37/week @ 2024-09-23 19/week @ 2024-09-30 7/week @ 2024-10-07 10/week @ 2024-10-14

87 downloads per month
Used in bulloak

MIT/Apache

250KB
5.5K SLoC

bulloak-foundry

bulloak-foundry is a Rust crate that serves as a backend for generating Foundry tests from bulloak-syntax Abstract Syntax Trees (ASTs). It provides functionality to scaffold Solidity test files and check existing tests against specifications.

Features

  • Generate .t.sol files with scaffolded Foundry tests from bulloak-syntax ASTs.
  • Check existing Solidity test files against .tree specifications.
  • Implement and enforce custom rules for test structure and content.
  • Automatic fixing of certain rule violations.

Usage

To use bulloak-foundry in your project, add it to your Cargo.toml:

[dependencies]
bulloak-foundry = "0.1.0"  # Replace with the actual version

Scaffolding Tests

use bulloak_foundry::scaffold;

fn main() -> anyhow::Result<()> {
    let tree_spec = "Your .tree specification here";
    let foundry_test = scaffold::scaffold(tree_spec)?;

    // Write foundry_test to a .t.sol file

    Ok(())
}

Violation Checking

bulloak-foundry includes a system for defining and checking rules against Solidity test files. Violations can be of different kinds, as defined in the ViolationKind enum.

License

This project is licensed under either of:

Dependencies

~27–44MB
~746K SLoC