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

Fix default test selection in the absence of--match-test #383

Merged
merged 14 commits into from
Feb 22, 2024

Conversation

palinatolmach
Copy link
Collaborator

@palinatolmach palinatolmach commented Feb 21, 2024

Closes #382.

This PR refactors the logic for selecting tests for verification if no --match-test is provided to:

  • include tests that start with check and prove, in addition to test, following a similar change in Verify proveX and checkX functions similarly to testX #249
  • instead of selecting test contracts ending with Test, verify contracts located in the test folder (by default) or in the one specified in foundry.toml, e.g.
test = 'test/kontrol/proofs'

This seems to be the approach Foundry is using to select tests, e.g., forge test executes tests located in OptimismPortalKontrol (not ending with Test), but doesn't analyze test contracts located in folders other than test:

❯ forge test
...
Running 3 tests for test/OptimismPortal.k.sol:OptimismPortalKontrol
[PASS] test_finalizeWithdrawalTransaction_paused(...) (runs: 256, μ: 81151, ~: 82169)

Adding / to such test directory is needed to ensure that we're matching a folder (not just the test keyword) against the contract path.

@palinatolmach palinatolmach marked this pull request as ready for review February 21, 2024 09:01
Copy link
Contributor

@anvacaru anvacaru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with a single suggestion!

src/kontrol/foundry.py Outdated Show resolved Hide resolved
@rv-jenkins rv-jenkins merged commit acd5602 into master Feb 22, 2024
11 checks passed
@rv-jenkins rv-jenkins deleted the fix-default-tests branch February 22, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor test selection if no --match-test is provided
3 participants