melak47
c638c57209
Add StringMaker for std::variant, std::monostate ( #1380 )
...
The StringMaker is off by default and can be enabled by a new macro `CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER`, to avoid increasing the footprint of stringification machinery by default.
2018-09-20 14:13:35 +02:00
melak47
a575536abe
Add StringMaker for std::(w)string_view
...
Fixes #1375
2018-09-10 11:37:26 +02:00
Julien Nitard
7be8a41adf
Fix ambiguity in stringification
...
Happening when using clang and templated operators, clang cannot decide
between the operator provided by ReusableStringStream and the one provided
by the value value as both are templates. This is easily solved by calling
the operator<< through the member syntax.
Fixes #1285
2018-06-06 22:33:03 +02:00
Martin Hořeňovský
4c7b7d04fe
Move FALLBACK_STRINGIFIER to before the enum and range fallbacks
...
This should align more closely with the intended semantics, where
types without `StringMaker` specialization or `operator<<` overload
are passed down to the user defined fallback stringifier.
Related to #1024
2018-05-14 20:38:05 +02:00
Martin Hořeňovský
6c5c4c43a0
Add stringification support to std::exception and deriving classes
...
This support is based on overriden `std::exception::what` method, so
if an exception does not do so meaningfully, the message is still
pointless.
This is only used as a fallback, both `StringMaker` specialization and
`operator<<` overload have priority..
2018-05-12 17:46:25 +02:00
Martin Hořeňovský
ab30621138
Fix stringifying static array of unsigned chars
...
The fix leaves an open question: should we keep treating refs
to static array of chars as strings, or should we instead
use `strnlen` to check if it is null-terminated within the buffer
Fixes #1238
2018-04-06 11:43:12 +02:00
David Aue
dfb83f20e9
Add stringification methods for CLR objects
2018-04-03 19:06:16 +02:00
Tomas Zeman
352853ed7e
Introduce conditional wchar_t (and std::wstring) support
...
The support is turned on by default but the user might need to be able
to turn it off which is now possible by defining CATCH_CONFIG_NO_WCHAR.
2018-03-07 10:35:31 +01:00
Martin Hořeňovský
da783abee9
Move fallback conversion after enum-check
2018-02-15 16:06:35 +01:00
Martin Hořeňovský
34d7a33574
Add a way to change fallback stringifier
...
This allows reuse of projects existing stringification machinery
Closes #1024
2018-02-11 16:31:12 +01:00
Zachary Michaels
4be81d3588
Remove unnecessary semicolons
2018-02-05 10:03:51 +01:00
Martin Hořeňovský
126850e76b
Prefer operator<< to range-based stringification
...
Fixes #1172
2018-02-01 14:07:23 +01:00
Martin Hořeňovský
8d854c689b
Provide useful and unambigous stringification for static arrays
2018-01-14 18:06:43 +01:00
Phil Nash
421ab16062
Exclude string-literal arrays from automatic range serialisation
...
These have specialised serialisers already anyway, and were causing ambiguities in VS 2015 & 2017
2018-01-08 15:15:44 +00:00
Phil Nash
32eb90b9bd
Fix stringifying of unknown enums
2018-01-04 10:21:52 +00:00
Phil Nash
702cfdaf6e
Added special handling for vector<bool> when stringifying
2018-01-04 10:05:02 +00:00
Phil Nash
af3f2499bc
Added generic container detection in StringMaker.
...
Removed vector specialisation as this is now covered generically - as are any containers that can be called via (freestanding) begin/ end
2018-01-04 09:30:06 +00:00
Martin Hořeňovský
baf3d2f360
Split out ratio_string::symbol bodies
2017-11-19 14:54:52 +01:00
Martin Hořeňovský
b083b04126
Fix compilation when using g++ with libc++
...
Fixes #1110
2017-11-19 14:47:18 +01:00
Martin Hořeňovský
13370bddf2
Revert "Move <ctime> include out of line"
...
This reverts commit 36f02d76d6
.
2017-11-08 08:31:48 +01:00
Martin Hořeňovský
36f02d76d6
Move <ctime> include out of line
2017-11-07 21:59:52 +01:00
Phil Nash
56e1075613
Introduced ReusableStringStream and removed all uses of std::ostringstream from the main path
...
ReusableStringStream holds a std::ostringstream internally, but only exposes the ostream interface.
It caches a pool of ostringstreams in a vector which is currently global, but will be made thread-local.
Altogether this should enable both runtime and compile-time benefits. although more work is needed to realise the compile time opportunities.
2017-11-07 18:01:10 +00:00
Martin Hořeňovský
4899d891d3
Fix MSVC compilation when stringifying std::chrono::time_point
2017-10-09 13:13:30 +02:00
Martin Hořeňovský
79b405fd3f
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.
2017-10-09 13:03:29 +02:00
Martin Hořeňovský
9aa96712ae
Sweep out some extra warnings
...
Swept:
`-Wpadded` in some places (where it caused extra size, instead of just
saying "hey, we padded struct at the end to align, just as standard says")
`-Wweak-vtables` everywhere (Clang)
`-Wexit-time-destructors` everywhere (Clang)
`-Wmissing-noreturn` everywhere (Clang)
The last three are enabled for Clang compilation going forward.
Also enabled `-Wunreachable-code` for Clang and GCC
2017-09-07 17:25:15 +02:00
Phil Nash
03d41ce5b9
Suppressed meaningless function type qualifier warning in MSVC again
...
(this time in catch_tostring.h)
2017-09-07 11:25:10 +01:00
Phil Nash
2d37649377
Fixed Objective-C mode
2017-09-06 15:44:42 +01:00
Martin Hořeňovský
9de729b515
General cleanup
2017-07-27 11:32:01 +02:00
Phil Nash
0a614ee5ba
re/moved some headers in catch_tostring
2017-07-19 08:31:10 +01:00
Phil Nash
cd6f6c021a
Minor clean-ups in string conversion code
2017-07-19 08:16:55 +01:00
Phil Nash
e62a9aa444
Removed const refs from NSString/ NSObject overloads (effectively reapplies PR #855 originally applied to "1.x" master)
2017-06-26 16:48:38 +01:00
Martin Hořeňovský
67914d8b86
Move back to static StringMaker<T>::convert
...
This avoids some breakage from the modernization
2017-05-21 23:40:05 +02:00
Martin Hořeňovský
c5c3d368a2
Added std:: qualification to nullptr_t
...
Apparently Clang doesn't like it unqualfied 😄
2017-05-03 00:29:36 +02:00
Martin Hořeňovský
33ed1773f4
Reworked stringification layer, removed Catch::toString
...
Now the order of stringification checks is
1) StringMaker specialization
2) operator<<
toString overloads and specializations have been removed.
2017-05-02 23:51:03 +02:00
Martin Hořeňovský
c6980ec2d8
Remove C++98 backcompat from toString
2017-04-25 11:21:22 +02:00
Sergey Semushin
94425ad59b
Add opt-in c++11 stream insertable check. ( #877 )
...
* Add opt-in c++11 stream insertable check.
To opt-in, define CATCH_CONFIG_CPP11_STREAM_INSERTABLE_CHECK.
Opt-in fixes #872 and should fix #757 as well.
2017-04-05 09:53:10 +02:00
Phil Nash
e91738103c
Stripped trailing whitespace from all source code lines
...
(replaces need for PRs #310 and #504 )
2015-11-04 18:04:15 +00:00
Phil Nash
733ebb6024
Added CATCH_CONFIG_CPP11_LONG_LONG support
2015-07-23 23:05:05 +01:00
Phil Nash
805de43a3d
Use CATCH_NULL instead of NULL
...
- expands to nullptr if CATCH_CONFIG_CPP11_NULLPTR is defined (see #444 )
2015-07-01 07:33:27 +01:00
Phil Nash
7ab3b5aefb
Added compiler feature suppression macros
...
_NO_ forms to disable detection of features - particularly C++11 features.
Also removed SFINAE detection (and use in tostring)
2015-06-30 08:41:55 +01:00
Phil Nash
e86daf8bdd
Reorganised C+11 feature detection a bit
...
and added CATCH_CONFIG_CPP11_NULLPTR for VS2015
2015-05-19 22:31:57 +01:00
Phil Nash
572911d880
Changed comment to work around header stitching bug
2015-03-04 18:33:31 +00:00
Phil Nash
75a08bbc6c
Merge branch 'tuple_to_string' of https://github.com/PureAbstract/Catch into PureAbstract-tuple_to_string
2014-12-30 18:42:17 +00:00
Phil Nash
b0545d1f12
Some toString cleanups
2014-12-09 18:49:58 +00:00
Phil Nash
ea33961b43
Factored out mention of "unprintable string" ("{?}")
2014-09-08 08:14:59 +01:00
Andy Sawyer
022a0b4fcb
catch_tostring: toString for std::tuple
2014-09-04 00:31:11 +01:00
Andy Sawyer
3196937343
catch_tostring: Add includes for tuple, type_traits
2014-09-04 00:17:36 +01:00
Andy Sawyer
95956444b7
catch_tostring: Move toString overload declarations
...
- Put all the declarations of the overloads early in the file, so they
get seen by the templates later on
2014-09-04 00:12:25 +01:00
Andy Sawyer
cd2a5aa688
catch_tostring: tostring for enum class types
2014-09-01 17:38:17 +01:00
Ben Arnold
7b0a84a048
toString handles wchar_t raw strings
2014-08-14 12:28:23 +01:00