catchorg / Catch2

A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
https://discord.gg/4CWS9zD
Boost Software License 1.0
18.51k stars 3.04k forks source link

Separate headers for "extra" std types #2851

Open amerry opened 5 months ago

amerry commented 5 months ago

Description Currently, to add stringification for std::optional, say, you need to define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER. This can be tricky to get right with things like pre-compiled headers, unity builds, or other tricks to speed up the build, without dragging it into every single unit test file in the project.

Given Catch2v3 has already gone down the route of using separate headers for extra functionality, it would be useful to have this option here as well - put the relevant StringMaker specialisations into their own headers. That way, enabling formatted output of these types would just involve adding an extra #include, and it would work just fine with PCH, unity builds, etc.