Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Provide a way to specify condition names #78

Open
alexfertel opened this issue Jul 11, 2024 Discussed in #77 · 1 comment
Open

Feature: Provide a way to specify condition names #78

alexfertel opened this issue Jul 11, 2024 Discussed in #77 · 1 comment
Assignees
Labels
Feat New feature or request Uphill Needs research before being implemented

Comments

@alexfertel
Copy link
Owner

Discussed in #77

Originally posted by clauBv23 July 10, 2024
When testing complex code a common scenario scenario involves verifying specific behaviors under different setups. For example in Sablier V2 Core, the test tree looks like this:

             ...
            └── given all streams are warm
            ├── when the caller is unauthorized for all streams
            │  ├── when the caller is a malicious third party
            │  │  └── it should revert
            │  └── when the caller is the recipient
            │     └── it should revert
            ├── when the caller is unauthorized for some streams
            │  ├── when the caller is a malicious third party
            │  │  └── it should revert
            │  └── when the caller is the recipient
            │     └── it should revert
            ...

This tree structure checks that when the caller is a malicious third party and when the caller is the recipient should revert in both cases: when the caller is unauthorized for all streams and when the caller is unauthorized for some streams.

Using bulloak, this specification fails because in Solidity two functions or modifiers cannot have the same signature.

However, in the Sablier V2 Core repo this issue is managed by also appending the scenario description to the function name instead of just creating a modifier, as shown below:

function test_RevertWhen_CallerUnauthorizedAllStreams_MaliciousThirdParty()
        external
        whenNotDelegateCalled
        whenArrayCountNotZero
        givenNoNull
        givenAllStreamsWarm
        whenCallerUnauthorized
    

Is there a way to handle this in bulloak? or any workaround for this issue?

Perhaps a special word, character, or ASCII sequence in the tree, could be used to append the description to the function name?

@alexfertel alexfertel added Feat New feature or request Uphill Needs research before being implemented labels Jul 11, 2024
@alexfertel alexfertel self-assigned this Jul 11, 2024
@clauBv23
Copy link

Adding a comment to receive notifications on updates 👀 🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feat New feature or request Uphill Needs research before being implemented
Projects
None yet
Development

No branches or pull requests

2 participants