A simple, fast, and easy to use Solidity test generator based on the Branching Tree Technique.
bash
cargo install bulloak
Say you have a foo.tree
file with the following contents:
text
foo.sol
└── when stuff called
└── it should revert
If you pass it to bulloak
like so, you will get the skeleton
of a test contract printed to stdout
:
``` $ bulloak foo.tree pragma solidity [VERSION];
contract FooTest { modifier whenStuffCalled() { _; }
function testRevertsWhenStuffCalled()
external
whenStuffCalled
{
}
} ```
If you are working in a solidity project and you have
multiple trees you want to scaffold, you can use the -w
option.
$ bulloak -w ./**/*.tree
This will create solidity
files with the same name as the .tree
files with the result of scaffolding each tree.
``` Usage: bulloak [OPTIONS] [FILES]...
Arguments: [FILES]... .tree files to process
Options:
-c Whether to print it
branches as comments in the output code
-i
Another feature of bulloak
is reporting errors in your input trees.
For example, say you have a buggy foo.tree
file, which is missing a
└
character. Running bulloak foo.tree
would report the error like this:
``
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
bulloak error: unexpected
when` keyword
── when the id references a null stream ^^^^
--- (line 2, column 4) --- file: foo.tree ```
Please refer to CONTRIBUTING.md.
bulloak
is heavily inspired by BurntSushi's regex crate.
This project is licensed under either of: