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

Replace --test test,id by --test test:id in the foundry-prove test argument #2052

Closed
iFrostizz opened this issue Aug 29, 2023 · 0 comments · Fixed by #2064
Closed

Replace --test test,id by --test test:id in the foundry-prove test argument #2052

iFrostizz opened this issue Aug 29, 2023 · 0 comments · Fixed by #2064
Assignees
Labels
bug Something isn't working

Comments

@iFrostizz
Copy link
Contributor

The regex that should check if there is an id specified by the user in the --test flag of the foundry-prove command currently cannot make the difference with commas that separate function arguments, so it would be good to replace it with something like a colon : and forget about using regex, but instead

if value.find(':') > 0:
    test, id = value.split(':', 1)
else:
    id = None
    test = value

def _parse_test_id_tuple(value: str) -> tuple[str, str | None]:
pattern = r'^([^,]+)(?:,\s*(\S+))?$'
match = re.match(pattern, value)
if match:
groups = match.groups()
return groups[0], groups[1] if groups[1] is not None else None
else:
raise argparse.ArgumentTypeError("Invalid tuple format. Expected 'test, id' or 'test'")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants