- 
                Notifications
    You must be signed in to change notification settings 
- Fork 73
test: standardize test function names across codebase #731
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
base: main
Are you sure you want to change the base?
Conversation
| ✅ Deploy Preview for contracts-stylus canceled.
 | 
| @0xNeshi, can you please review this so I can do the next one | 
| Hey @Ifechukwudaniel , appreciate the enthusiasm! We're currently under a huge workload, and will review the PR as soon as it is reduced. Thanks! | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job. Left some comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please resolve merge conflicts
| })); | ||
|  | ||
| Ok(()) | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change errors_when_invalid_receiver_contract_in_batch_mint to mint_batch_reverts_when_receiver_invalid
|  | ||
| Ok(()) | ||
| } | ||
|  | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change error_invalid_array_length_in_batch_mint to mint_batch_reverts_when_array_length_invalid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!
I see the second part of convention function_name_revert_when_condition is not applicable for crypto library.  Namely revert_when syntax relates to smart contracts domain only.
|  | ||
| #[test] | ||
| fn add() { | ||
| fn add_succeeds_for_field_elements() { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two test cases have an inconsistent description: "succeeds_for_field_elements" and "succeeds_with_expected_value" but test cases are quite similar.
@0xNeshi is "description" mandatory in our convention for successful tests? (function_name_description).
Can't we leave it as "" here??xD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with leaving just add for simple test cases OR ones that test the same function from multiple vectors
| On it, i will complete it | 
Co-authored-by: Nenad <[email protected]>
Co-authored-by: Nenad <[email protected]>
Co-authored-by: Nenad <[email protected]>
Co-authored-by: Nenad <[email protected]>
Co-authored-by: Nenad <[email protected]>
Co-authored-by: Nenad <[email protected]>
Co-authored-by: Nenad <[email protected]>
Co-authored-by: Nenad <[email protected]>
Co-authored-by: Nenad <[email protected]>
Co-authored-by: Nenad <[email protected]>
Co-authored-by: Nenad <[email protected]>
This PR standardizes test function names across the codebase to follow a consistent naming pattern:
function_name_descriptionfor successful casesfunction_name_revert_when_conditionfor expected revertsThis improves clarity, consistency and makes it easier to understand the purpose of each test at a glance.
Closes: 491
Checklist: