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

Quote test names before they are used within the regex to rerun #338

Merged
merged 1 commit into from
Jun 16, 2023

Conversation

noBlubb
Copy link
Contributor

@noBlubb noBlubb commented Jun 14, 2023

Fixes #337: The (sub) test names were not quoted before being used within the regex passed to -run and therefore caused go test to mis-evaluate the expression if there were parentheses contained. Uses https://pkg.go.dev/regexp#QuoteMeta to make it work for a wider range of characters.

@noBlubb noBlubb marked this pull request as ready for review June 14, 2023 11:12
@noBlubb noBlubb force-pushed the fix/quote_testnames_for_regex branch from dd19271 to 3efa4ee Compare June 14, 2023 12:41
@dnephin dnephin force-pushed the fix/quote_testnames_for_regex branch from 3efa4ee to 6f6b09d Compare June 16, 2023 03:16
Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

This is great, thank you!

I made one very minor change to the expected value in the test. I change to a raw string so that it's a bit easier to see the value without extra escapes.

@dnephin dnephin merged commit 9cca4bb into gotestyourself:main Jun 16, 2023
7 checks passed
@noBlubb
Copy link
Contributor Author

noBlubb commented Jun 16, 2023

Nice! Really helps to highlight the expected behavior and not get distracted by other escaping, thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subtest with parenthesis in name fail to rerun
2 participants