Add stringification for std::chrono::{duration,time_point}

Also hides std::chrono, std::pair and std::chrono::* behind
new configuration macros, CATCH_CONFIG_ENABLE_*_STRINGMAKER
to avoid dragging in <utility>, <tuple> and <chrono> in common
path, unless requested.
This commit is contained in:
Martin Hořeňovský
2017-10-09 12:31:22 +02:00
parent f972732737
commit 79b405fd3f
12 changed files with 408 additions and 48 deletions

View File

@@ -1,14 +1,15 @@
<a id="top"></a>
# Compile-time configuration
**Contents**
[main()/ implementation](#main-implementation)
[Prefixing Catch macros](#prefixing-catch-macros)
[Terminal colour](#terminal-colour)
[Console width](#console-width)
[stdout](#stdout)
[Other toggles](#other-toggles)
[Windows header clutter](#windows-header-clutter)
**Contents**
[main()/ implementation](#main-implementation)
[Prefixing Catch macros](#prefixing-catch-macros)
[Terminal colour](#terminal-colour)
[Console width](#console-width)
[stdout](#stdout)
[Other toggles](#other-toggles)
[Windows header clutter](#windows-header-clutter)
[Enabling stringification](#enabling-stringification)
Catch is designed to "just work" as much as possible. For most people the only configuration needed is telling Catch which source file should host all the implementation code (```CATCH_CONFIG_MAIN```).
@@ -121,6 +122,17 @@ On Windows Catch includes `windows.h`. To minimize global namespace clutter in t
CATCH_CONFIG_NO_NOMINMAX // Stops Catch from using NOMINMAX macro
CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN // Stops Catch from using WIN32_LEAN_AND_MEAN macro
## Enabling stringification
By default, Catch does not stringify some types from the standard library. This is done to avoid dragging in various standard library headers by default. However, Catch does contain these and can be configured to provide them, using these macros:
CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER // Provide StringMaker specialization for std::pair
CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER // Provide StringMaker specialization for std::tuple
CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER // Provide StringMaker specialization for std::chrono::duration, std::chrono::timepoint
CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS // Defines all of the above
---
[Home](Readme.md#top)

View File

@@ -22,7 +22,9 @@
* Removed support for non-const comparison operators
* Non-const comparison operators are an abomination that should not exist
* They were breaking support for comparing function to function pointer
* `std::pair` and `std::tuple` are no longer stringified by default
* This is done to avoid dragging in `<tuple>` and `<utility>` headers in common path
* Their stringification can be enabled per-file via new configuration macros
## Improvements
* Reporters and Listeners can be defined in files different from the main file
@@ -53,7 +55,8 @@
* Reporters/Listeners are now notified of fatal errors
* This means specific signals or structured exceptions
* The Reporter/Listener interface provides default, empty, implementation to preserve backward compatibility
* Stringification of `std::chrono::duration` and `std::chrono::time_point` is now supported
* Needs to be enabled by a per-file compile time configuration option
## Fixes
* Don't use console colour if running in XCode