Skip to content

Conversation

vtjl10
Copy link
Contributor

@vtjl10 vtjl10 commented Oct 15, 2025

Description:

This pull request refactors the ContractRunner to eliminate duplicated code for validating setUp and afterInvariant functions within the run_tests method.

Changes

  • Extracted a new helper function: A new private method, validate_special_function, has been introduced. This function now encapsulates the shared logic for:

    • Verifying that no more than one special function (like setUp) is defined.
  • Simplified run_tests: The main test running function now calls this new helper, making the control flow cleaner and more readable.

Reasoning

This refactoring adheres to the DRY (Don't Repeat Yourself) principle, which significantly improves code maintainability. By centralizing the validation logic, we make it easier to modify in the future and reduce the chance of introducing bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant