-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Allow using only types in TEMPLATE_TEST_CASE_SIG.
#2995
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
Merged
horenmar
merged 3 commits into
catchorg:devel
from
legrosbuffle:allow-no-non-type-template-param
Jul 8, 2025
Merged
Allow using only types in TEMPLATE_TEST_CASE_SIG.
#2995
horenmar
merged 3 commits into
catchorg:devel
from
legrosbuffle:allow-no-non-type-template-param
Jul 8, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Right now `TEMPLATE_TEST_CASE_SIG` fails to compile when the signature contains only types:
```
TEMPLATE_TEST_CASE_SIG(
"TemplateTestSig: compiles with two type parameters",
"[template][onlytypes]",
((typename U, typename V), U, V), (int,int)) {}
```
The trick is to resolve the ambiguity between the two overloads of
`get_wrapper` (`TypeList` and `Nttp`) by making one match more strongly.
We also need to allow `reg_test` to register more than one type.
Add unit tests.
Fixes catchorg#2680
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## devel #2995 +/- ##
==========================================
- Coverage 91.14% 90.99% -0.16%
==========================================
Files 198 198
Lines 8514 8609 +95
==========================================
+ Hits 7760 7833 +73
- Misses 754 776 +22 🚀 New features to boost your workflow:
|
Member
|
Thanks. I made small changes for the tests to pass and to avoid polluting the global namespace with the priority tag. |
GerHobbelt
added a commit
to GerHobbelt/Catch2
that referenced
this pull request
Aug 27, 2025
v3.9.0 === Improvements === * **Added experimental opt-in support for thread safe assertions** * Read the documentation for full details * **The default test run order has been changed to random** * Passing assertions are significantly faster when the reporter does not ask for `assertionEnded` events on passing assertions. * This is the default behaviour of e.g. Console or Compact reporter * Simple `REQUIRE(true)` is 60% faster in Release and 80% faster in Debug build configuration * Simple `REQUIRE_NOTHROW` is 230% faster in Release and 430% faster in Debug build configuration * Simple `REQUIRE_THROWS` is ~3% faster in Release and 20% faster in Debug build configuration (throwing introduces enough overhead that the optimizations inside Catch2 are mostly irrelevant) * Small (2-5%) improvement if the reporter asks for `assertionEnded` events for passing assertions. * The exit code constants are part of the Session API. (catchorg#2955, catchorg#2976) * Suppressed unsigned integer overflow checking in locations with intended overflow (catchorg#2965) * Reporters flush output after writing metadata, e.g. rng seed (catchorg#2964) * Added unreachable after `FAIL` and `SKIP` macros (catchorg#2941) * This allows the compiler to understand that the execution does not continue past the macro, and avoids warnings. * Added fast path for `assertionStarting` event when no reporter requires it * For backwards compatibility, this fast path is opt-in * A reporter can opt in by changing its `ReporterPreferences::shouldReportAllAssertionStarts` * Improved last seen source location tracking to be more precise * This is used when reporting unexpected exceptions from tests === Fixes === * Fixed formatting of tags with more than 100 tests in the default `--list-tags` output (catchorg#2963) * Fixed Clang-Tidy's `readability-static-accessed-through-instance` in tests * Fixed most of Clang-Tidy's `cppcoreguidelines-avoid-non-const-global-variables` (catchorg#2582) * The lifetime of scoped messages now strictly obeys their scope (catchorg#1759, catchorg#2019, catchorg#2959) * Previously Catch2 would try to keep them around during unexpected exception, to provide helpful context. * The amount of surprises the irregularities caused was not worth the occasional utility provided. * `TEMPLATE_TEST_CASE_SIG` can handle signatures consisting of only types (catchorg#2680, catchorg#2995) * Moved `catch_test_run_info.hpp` up from `internal/` subfolder into the main one (catchorg#2972) === Miscellaneous === * pkg-config files are now generated at install time (catchorg#2979) * This fixes missing debug suffix in library names * This fixes install prefix mismatch between build config and actuall installation # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCgAdFiEE8QyLZSqAHw/oZQgX3kgwe4sNOBoFAmiCkWIACgkQ3kgwe4sN # OBrohA//VM0MoWEyb1Mp9Lw4pw07CL7EnqsgOnOjEu1EgN1tyDMEw3vf/uysiY4X # ab7RwVzCd0WVnixmNsduhzotCC0o4cDupPNXMTiRgO7ijtzLOfCsUqc+ZuIP0xUJ # a1IcokrQM/FYPfltBfJUCQdpWHX/Co0dDNtXlCjY2Ur3Ek/4w4M8efARKZi1xi+C # WDprUrOcYCWlYSzRa7LXWbkoCETdEphQCIXfCo8/kIbIf8+roJuiH/9RE6UrdeDY # yQfH6qLUoPdfeIQGGJY+dN+rVfsQkBBM2V6dsYcNsAXWsHEzDFJhI1KQHNw51T+3 # MSaGmUKa3ptwW8p+ecEsqdSiygMBmrVW+x1Oqk/FCuW1r7lDemnh9ZjyIt2PRfxO # 6AxTepyT2wJhjHK/UecIxhh7Xba7Cbbu9vT3FplJFtLI4MVgXFpo4hFKHGl2Y+oI # okJgoDb+Bh2sWqqFQdKfIq+0ntn8Oqfas64QV7jmT/M1f9ENMqrunEnmQzPGcu8t # ckly4+WVTCXAoSseKWJasJgFCPQjrjQYcaEtQNCNyYLSjLFJIMNmXp5NrlSmtLHv # va7JIMLEgar4kMuiRUeu3Tz0mDrWti4/eX503vBs/BF8/O8m6XKnv7vXcVhg2mQW # pLT5qM8bbAv0AnxHFgewD2ztuEoTPECqq6T06t77EHYDTPhys/4= # =6rlc # -----END PGP SIGNATURE----- # gpg: Signature made Thu Jul 24 22:02:42 2025 WEDT # gpg: using RSA key F10C8B652A801F0FE8650817DE48307B8B0D381A # gpg: Can't check signature: No public key # Conflicts: # extras/catch_amalgamated.cpp # extras/catch_amalgamated.hpp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now
TEMPLATE_TEST_CASE_SIGfails to compile when the signature contains only types:The trick is to resolve the ambiguity between the two overloads of
get_wrapper(TypeListandNttp) by making one match more strongly. We also need to allowreg_testto register more than one type.Add unit tests.
Fixes #2680