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 testRevertWhenStuffCalled() external whenStuffCalled { // it should revert } } ```
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.
If there exists a file with a title that matches the name at the
root node of the .tree
, then bulloak
will skip writing that file.
However, you may override this behaviour with the -f
flag. This
will write to the filesystem overwriting any files that exist.
``` Usage: bulloak [OPTIONS] [FILES]...
Arguments: [FILES]... .tree files to process
Options:
-c
Whether to print it
branches as comments in the output code
-i write_files
is specified, use --force-write
to overwrite the output files
-s, --solidity-version
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: