alexfertel / bulloak

Generate tests based on the Branching Tree Technique.
https://bulloak.dev
Apache License 2.0
260 stars 14 forks source link

Add documentation for renaming test contracts #83

Open scorpion9979 opened 1 month ago

scorpion9979 commented 1 month ago

I went down the BTT some time in the past while researching and contributing to the Sablier V2 code base and noticed that test files generated by Bulloak would have different test contract names than those of Sablier V2.

It could be helpful to devs to add tips in README.md on how to easily rename generated test contracts in VSCode with a simple regex search and replacement as follows:

Example:

A .tree file employing Sablier V2 format for the test label and filename: functionToTest.t.sol.

functionToTest.t.sol
├── Given one condition
│   └── It should never revert
└── Given another condition
    └── It should succeed

Search: (\w+)tsol Replace: \u$1_Unit_Concrete_Test or \u$1_Integration_Concrete_Test

Executing the above search and replacement would rename the Bulloak generated test contract name from functionToTesttsol to FunctionToTest_Unit_Concrete_Test or FunctionToTest_Integration_Concrete_Test respectively.

alexfertel commented 1 month ago

Hey @scorpion9979! I have a somewhat contrarian opinion that this shouldn't be in the README. The ideal solution here is to make these changes in the Sablier repo.

This effort will potentially be done in the future so that features missing in bulloak to support the Sablier repo are added + changes required to use bulloak there are made.

PS. I think that regex could be simplified to (\w+)tsol, right?

scorpion9979 commented 1 month ago

@alexfertel That sounds good. I felt this should still be documented somewhere as I occasionally had to run this particular search and replacement. Also, you're right regarding the simplified regex. I've updated the description of the issue to use the simplified version.