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

Improve test-naming abilities for parameterized tests #2771

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

tophyr
Copy link

@tophyr tophyr commented Nov 30, 2023

Catch2 generates names for the TEMPLATE_* style test definition macros, and the naming can be improved somewhat. This PR adds the ability to control the separator - for situations where external forces might preclude things like spaces in a test name - and also the ability to specify a string associated with a type for a template-list test.

Addresses Issue #2542

Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Merging #2771 (df90ea3) into devel (53d0d91) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #2771      +/-   ##
==========================================
+ Coverage   91.51%   91.55%   +0.04%     
==========================================
  Files         198      199       +1     
  Lines        8243     8246       +3     
==========================================
+ Hits         7543     7549       +6     
+ Misses        700      697       -3     

@tophyr
Copy link
Author

tophyr commented Dec 5, 2023

I've ended up eliminating the RTTI sections of this PR - users can look up RTTI in their IndexedTestTypeName<> implementations if they choose. The compiler differences around RTTI complicate testing to the point that I'll stick that stuff in a different PR.

@tophyr
Copy link
Author

tophyr commented Dec 5, 2023

@horenmar when you get some time, would love eyes on this and any feedback or thoughts.

Catch2 produces tests names with spaces by default when using
type-parametric macros like `TEMPLATE_TEST_CASE` and
`TEMPLATE_PRODUCT_TEST_CASE`. For some test-runners that are
incompatible with spaces in test names, this presents a significant
problem: It's possible to define a test that's impossible to run.

This adds a `CATCH_CONFIG_NAME_SEPARATOR` configuration value that can
be used to override the separator string used during test naming.
It's not often very useful to name tests simply by incrementing numbers.
This change adds a mechanism by which a name can be generated using both
the index of the type in the type list, and also some from the type
itself somehow.
@tophyr
Copy link
Author

tophyr commented Dec 11, 2023

Rebased to 3.5.0

@tophyr
Copy link
Author

tophyr commented Mar 15, 2024

pingping @horenmar

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.

None yet

1 participant