Skip to content

fix: prevent library functions with "invariant" prefix from being misclassified as test functions #10432

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

crStiv
Copy link

@crStiv crStiv commented May 3, 2025

Motivation

Fixes issue #10418 where library functions with names starting with "invariant" were incorrectly classified as invariant tests, leading to test and coverage failures.

Solution

  • Added a new is_library_function parameter to TestFunctionKind::classify method in crates/common/src/traits.rs
  • Implemented a heuristic in Function::tfe_is_library_function to detect library functions based on state mutability
  • Updated call sites in crates/forge/src/runner.rs to pass the correct library function status

This fix ensures that library functions with "invariant" prefix are no longer misclassified as test functions, resolving both test failures and coverage issues.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

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