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

Catch2: escape special characters in test names #123

Closed
gmgunter opened this issue Oct 31, 2023 · 1 comment · Fixed by #124
Closed

Catch2: escape special characters in test names #123

gmgunter opened this issue Oct 31, 2023 · 1 comment · Fixed by #124

Comments

@gmgunter
Copy link
Contributor

When specifying which tests to run from the command line, Catch2 treats some characters specially. For example, * is a wildcard character, ~ negates a test spec, etc.

However, these literal characters can also appear in test names. In order to match a specific test name that contains one or more special characters, they need to be escaped with a preceding backslash ("\").

You can also match test names with special characters by escaping them with a backslash ("\"), e.g. a test named "Do A, then B" is matched by "Do A, then B" test spec. Backslash also escapes itself.

(reference)

Currently, pytest-cpp reports a test failure for any tests with special characters in their name, with the following error message:

Internal Error: could not find test <test_id> in results:
:0: C++ failure

I believe this issue may be resolved by escaping any special characters in the test_id before invoking the test executable.

I'm happy to work on resolving this -- just want to make sure a fix would be welcome before making the effort to submit a PR.

@nicoddemus
Copy link
Member

I'm happy to work on resolving this -- just want to make sure a fix would be welcome before making the effort to submit a PR.

Yes thanks @gmgunter, that would be appreciated. 👍

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 a pull request may close this issue.

2 participants