Commit Graph

1579 Commits

Author SHA1 Message Date
Martin Hořeňovský
e8ec6bd73c General cleanup for C++11
Also less allocations and less stack usage on the fatal condition path
2017-08-31 11:46:37 +02:00
Martin Hořeňovský
e871742534 Move session to internal, split apart implementation 2017-08-31 10:31:52 +02:00
Martin Hořeňovský
6388fc946f Remove last usage of NotImplementedException
TeamCity reporter now uses CATCH_ERROR instead
2017-08-30 20:03:54 +02:00
Martin Hořeňovský
a4df0b2c37 Remove obsoleted utility functions on matchers
Natural operators, &&, || and ! are preferred and do not have
limited arity.
2017-08-30 19:45:09 +02:00
Martin Hořeňovský
49a1408ff2 Fix compilation of main file with CATCH_CONFIG_FAST_COMPILE 2017-08-30 18:07:29 +02:00
Martin Hořeňovský
9796c516bb Always compile matchers implementation 2017-08-30 18:06:48 +02:00
Martin Hořeňovský
255f7d7369 Minor cleanup 2017-08-30 15:53:39 +02:00
Martin Hořeňovský
0673b9be35 Split RNG related things into its own file
This further removes 2 function declarations from the common path
2017-08-30 15:32:44 +02:00
Martin Hořeňovský
48db47c737 Remove unused internal macro from the common path 2017-08-30 15:30:10 +02:00
Martin Hořeňovský
cde57d9365 Remove tag alias registry interface from the common path 2017-08-30 15:28:33 +02:00
Martin Hořeňovský
fc495ba0cb Dev build 3 2017-08-30 12:20:21 +02:00
Martin Hořeňovský
61d2c375dd Add evaluation specialization for T* and long
Fixes #1005
2017-08-30 12:11:41 +02:00
Martin Hořeňovský
dd8e79c529 Streamline includes in external interfaces 2017-08-29 16:44:02 +02:00
Martin Hořeňovský
4453fefb00 Remove check for compiler version before using __COUNTER__
All still supported compiler versions support __COUNTER__.
User can also still turn off use of __COUNTER__ by defining
CATCH_CONFIG_NO_COUNTER.
2017-08-29 15:45:58 +02:00
Martin Hořeňovský
6e46f29830 Remove empty compiler detection
If they are needed in the future, they can be reinstated, but there
is no point in keeping them around currently.
2017-08-29 15:40:19 +02:00
Martin Hořeňovský
92444d8b72 Remove catch_context.h from the common include path 2017-08-29 15:36:09 +02:00
Martin Hořeňovský
bcb430b837 Clean up various minor things 2017-08-29 14:02:14 +02:00
Martin Hořeňovský
5932576f53 Split writeToDebugConsole out of main path 2017-08-29 13:51:55 +02:00
Martin Hořeňovský
3b8b25c59d Make REGISTER_TEST_CASE auto registering
This also means it can be used in global scope
2017-08-29 09:52:58 +02:00
Martin Hořeňovský
75f143835e Prevent exception translator registration with CATCH_CONFIG_DISABLE 2017-08-29 09:52:25 +02:00
Martin Hořeňovský
05b6f03f3e Disable reporter/listener registration with CATCH_CONFIG_DISABLE 2017-08-29 09:48:52 +02:00
Sam Bristow
a04bd6d436 Remove duplicate CLI option
The "use-colour" option was accidentally duplicated as part of commit
feaf355 (Implemented libidentify support).
2017-08-28 12:16:23 +02:00
Martin Hořeňovský
053c29a2b8 Add partial implementation of CATCH_CONFIG_DISABLE
* Assertions are defined into (void)(0) no-op
* SECTIONs are defined away (leaving {} as scope)
* TEST_CASEs and TEST_CASE_METHODs are not registered.
* REGISTER_TEST_CASE is defined into (void)(0) no-op
* METHOD_AS_TEST_CASE is defined away
2017-08-27 22:05:25 +02:00
Martin Hořeňovský
8f6d6a4a2d Remove legacy [hide] tag
Also removed even legacier "./" prefix for test case name...
2017-08-27 16:45:53 +02:00
Martin Hořeňovský
e8d3be3621 Workaround raw string literal bug in VS2017 2017-08-27 12:38:59 +02:00
Martin Hořeňovský
7818e2666d v1.10.0 2017-08-26 15:34:18 +02:00
Martin Hořeňovský
cd30dd1a70 Workaround raw string literal bug in VS2017 2017-08-26 15:14:27 +02:00
Phil Nash
8e8c0c1675 Tweaked how failedButOk assertions are recorded
- fixes issue where sections in !shouldfail or !mayfail test cases that have failing assertions where marked as failed instead of failedButOk
2017-08-25 11:37:49 +01:00
Phil Nash
b1d0085796 Tweaked how failedButOk assertions are recorded
- fixes issue where sections in !shouldfail or !mayfail test cases that have failing assertions where marked as failed instead of failedButOk
2017-08-25 11:33:40 +01:00
Phil Nash
b6e7c9bd7a Specialise removeConst for nullptr 2017-08-24 23:07:44 +02:00
Phil Nash
180d9242f5 Suppress more signed/ unsigned mismatches during Evaluator calls on MSVC 2017-08-24 23:07:03 +02:00
Phil Nash
b7bd52cc98 Cherry-picked "evaluate" refactoring from dev-modernize branch
- fixed up NULL comparisons to allow for NULL being a long
- should address #981
2017-08-24 23:07:03 +02:00
Martin Hořeňovský
c03e8fce92 Explicitly ignore return value of getchar
This silences MSVC warning about ignored return value
2017-08-22 22:06:37 +02:00
Martin Hořeňovský
a7a9be59ff Ignore return value of getchar when waiting for keypress
Previously this was causing warnings under MSVC for ignored return
value.
2017-08-22 22:00:52 +02:00
Martin Hořeňovský
cb2fceb119 Force include catch_platform.h before any if-defs
Closes #994
2017-08-21 14:58:50 +02:00
Martin Hořeňovský
489b639587 Change include guards in catch_external_interfaces.h
Previously they weren't recognized by the generateSingleHeader.py
script and weren't removed during stitching
2017-08-18 19:33:00 +02:00
Phil Nash
5d6c1f4dd0 Dev build 2 2017-08-18 15:58:00 +01:00
Phil Nash
3bc03cd617 Went back to Catch 1.x behaviour for -d
-d takes "yes" or "no", rather than being a standalone flag option. The default is "defaultForReporter" so the previous change actually dropped some control.
2017-08-18 15:53:10 +01:00
Martin Hořeňovský
24af32f378 Add define that pulls in reporter and listeners interfaces
This allows users to define reporters and listeners in files different
from the main file.

Related to #991, #986
2017-08-17 20:23:30 +02:00
Phil Nash
0545de0a31 Hold translated exception in local string while matching 2017-08-17 19:21:00 +01:00
Martin Hořeňovský
597fca3c89 Remove <algorithm> header from the common path
It was only used for std::max<double> within Approx, so we now have
::Catch::Detail::max(double, double) that is used instead.
2017-08-17 20:04:53 +02:00
Martin Hořeňovský
f99f511155 Removed *_REGISTER_REPORTER from main path
Also simplified them to single macro: CATCH_REGISTER_REPORTER
2017-08-17 20:03:16 +02:00
Martin Hořeňovský
9a18ba042f Remove deprecated listener registration macro 2017-08-17 20:03:16 +02:00
Martin Hořeňovský
8e6641c19b Replace stdint.h include with cstdint include
Just small unification of includes
2017-08-17 20:03:16 +02:00
Phil Nash
aaedae60b4 Fixed issue with comparing non-copyable values 2017-08-17 16:46:05 +01:00
Phil Nash
8582780f11 Don't include string/ vector matchers if CATCH_CONFIG_MATCHERS defined 2017-08-16 14:38:04 +01:00
Phil Nash
a36395e2ff Changed use of strncpy to memcpy 2017-08-15 23:47:52 +01:00
Phil Nash
699e571400 Documented benchmark-resolution-multiple command line option
- and increased default to 100
2017-08-15 19:51:22 +01:00
Phil Nash
61c5675c11 Removed inadvertent use of auto merged from dev-modernise 2017-08-15 19:34:10 +01:00
Phil Nash
a988af219c No longer show full usage in event of error
(it obscures the error message)
- instead just suggests running with -? to see usage
2017-08-15 17:08:32 +01:00
Phil Nash
70e4af9d44 Implemented wait-for-keypress option 2017-08-15 14:12:11 +01:00
Phil Nash
917a51da6b Added libidentify support, including option for waiting for keypress on exit (and/ or start) 2017-08-15 13:48:14 +01:00
Phil Nash
7be258536e Suppress strncpy copy warnings on MSVC 2017-08-14 12:12:28 +01:00
Phil Nash
94d347b059 Removed StringData 2017-08-14 09:14:49 +01:00
Phil Nash
3772f69f0f Removed String and StringBuilder 2017-08-14 09:04:14 +01:00
Phil Nash
ece64c3b3a Removed redundant .c_str()s from StringRef usages 2017-08-14 08:54:57 +01:00
Phil Nash
fa3535e95e Added << ostream overload to StringRef 2017-08-14 08:50:44 +01:00
Phil Nash
c659e0fd3d StringRef conversions to/ from std::string 2017-08-14 08:39:14 +01:00
Phil Nash
1aab791d67 reformatted benchmark output a bit 2017-08-11 22:24:52 +01:00
Phil Nash
eed4ae86ad Added config to control multiple of clock resolution to run benchmark iterations for 2017-08-11 22:24:52 +01:00
Phil Nash
7fa5d9ca94 Removed redundant processName argument from libIdentify call 2017-08-11 22:03:09 +01:00
Phil Nash
feaf355489 Implemented libidentify support
- see https://github.com/janwilmans/LibIdentify
2017-08-11 19:55:55 +01:00
Martin Hořeňovský
2ce6c74f8f v1.9.7 2017-08-11 00:01:20 +02:00
Phil Nash
9688891868 Fix issue with fatal errors and non-failing assertions
Fixes #990
2017-08-10 21:44:54 +02:00
Phil Nash
684cbb2631 Fixes issue with fatal errors and non-failing assertions
Fixes #990
2017-08-10 17:10:13 +01:00
Phil Nash
97c06ca6fb Merge branch 'reevaluate' into dev-modernize 2017-08-10 16:18:05 +01:00
Martin Hořeňovský
3382312bd8 Remove obsoleted SCOPED_MSG and SCOPED_CAPTURE
Standard `MSG` and `CAPTURE` behave the same way these used to,
and are recommended instead.
2017-08-10 17:06:32 +02:00
Martin Hořeňovský
b435e0d7c7 Make default reporter configurable at compile time
Closes #978
2017-08-10 16:45:38 +02:00
Martin Hořeňovský
5da76bb7be Allow specifying default reporter at compile time 2017-08-10 16:24:31 +02:00
Martin Hořeňovský
11295a2663 Make catch_stream.hpp a standard .cpp file 2017-08-10 11:45:05 +02:00
Martin Hořeňovský
aa42dd92d1 Merge branch 'master' into dev-modernize 2017-08-10 11:34:26 +02:00
Martin Hořeňovský
7e4038d848 Capture std::clog writes and combine them with std::cerr writes (#989)
This also introduces Catch::clog() method to allow embedded targets
to override std::clog usage with their own stream (presumably null-sink),
similarly to how Catch::cout() and Catch::cerr() are used.

Fixes #989
2017-08-09 15:28:40 +02:00
Phil Nash
ee9b19efd3 Moved matcher-based capture macros into their own file
- this file excluded from the CATCH_CONFIG_DISABLE_MATCHERS path.
- matchers are always compiled in to the impl file
- _THROWS_WITH macros are still available with matchers disabled - but only the ones that take a string
- tests that use matchers have #ifdefs, so the whole SelfTest project can compile with matchers disable.
2017-08-09 12:10:14 +01:00
Phil Nash
b59e0ed48a Collapsed alternate capture macros now originals are redundant 2017-08-09 11:36:33 +01:00
Phil Nash
8d21b4a916 Removed some unnecessary #includes
- and don't #include "catch_debugger.h" in the header path when CATCH_CONFIG_FAST_COMPILE is defined
2017-08-09 10:51:50 +01:00
Phil Nash
4b5ac4d3d9 Actually do what the previous commit claimed to do!
:-s
2017-08-09 10:29:05 +01:00
Phil Nash
8382d99081 Workaround for GCC 4.8 "deleted ctor in aggregate" bug 2017-08-09 10:18:31 +01:00
Phil Nash
dc1df297e3 Suppressed some warnings
- signed/ unsigned mismatches
- virtual destructor on ITransientExpression (even though not needed)
2017-08-09 09:29:44 +01:00
Phil Nash
8c95a81448 Removed all (well, most) of the redundant, ResultBuilder-based, code 2017-08-09 09:08:33 +01:00
Phil Nash
7df290dfc1 Integrated new AssertionHandler into unexpected exception handling in RunContext 2017-08-09 08:49:59 +01:00
Phil Nash
201028d6ec Integrated INTERNAL_CATCH_THROWS with new AssertionHandler 2017-08-09 00:52:20 +01:00
Phil Nash
27fd8f80bd Integrated INTERNAL_CATCH_THROWS_STR_MATCHES with new AssertionHandler 2017-08-09 00:44:30 +01:00
Phil Nash
ef4fa56b71 integrated INTERNAL_CATCH_THROWS_MATCHES with new AssertionHandler 2017-08-08 23:41:55 +01:00
Phil Nash
9668410b8e integrated INTERNAL_CHECK_THAT with new AssertionHandler 2017-08-08 23:31:43 +01:00
Phil Nash
2832e23aa9 Restored exceptionGuard functionality under CATCH_CONFIG_FAST_COMPILE 2017-08-08 21:07:30 +01:00
Phil Nash
5f91724368 integrated AssertionHandler into INTERNAL_CATCH_MSG 2017-08-08 20:17:09 +01:00
Phil Nash
8a97beece2 integrated AssertionHandler into INTERNAL_CATCH_THROWS_AS 2017-08-08 19:43:07 +01:00
Phil Nash
f033f4f184 integrated AssertionHandler into INTERNAL_CATCH_NO_THROW 2017-08-08 19:36:18 +01:00
Phil Nash
f247ce5bff First cut of new AssertionHandler/ Decomposer
- integrated into INTERNAL_CATCH_TEST. Needs more work to fully replace existing stuff
2017-08-08 17:53:01 +01:00
Phil Nash
f8148ebae1 Made macroName and capturedExpression StringRefs 2017-08-08 01:22:21 +01:00
Phil Nash
59f9bcf1ed Reduced AssertionInfo to a pure record type 2017-08-08 01:08:07 +01:00
Phil Nash
5e60050299 Removed default ctors for AssertionInfo, AssertionResult and SourceLineInfo 2017-08-08 01:02:24 +01:00
Phil Nash
e658bacb04 Refactored how FAST_COMPILE affects internal test macros (less duplication) 2017-08-07 00:09:54 +01:00
Phil Nash
3a409e9fd4 Suppress more signed/ unsigned mismatches during Evaluator calls on MSVC 2017-08-06 00:38:03 +01:00
Phil Nash
63392e095e Refactored Evaluator templates to only be specialised on Op, with Lhs/Rhs types templated on method instead 2017-08-06 00:29:37 +01:00
Phil Nash
0a2ce87d32 Removed compare layer from expression evaluation 2017-08-06 00:13:00 +01:00
Phil Nash
b3b29f4b4c Use size_t for String size types 2017-08-05 22:53:21 +01:00
Phil Nash
cff3818e68 Correctly handle special tags that also imply being hidden (!benchmark) 2017-08-05 22:24:17 +01:00
Phil Nash
519db85758 Report benchmark durations in natural units
(and extended StringRef to be able to report utf8 char lengths
2017-08-05 21:41:56 +01:00
Phil Nash
4421672fb8 Removed benchmark tests from approval tests (for now) 2017-08-05 11:26:20 +01:00
Phil Nash
22e9ebef0d Factored table writing code out into a TablePrinter class (removes a lot of magic numbers and ad-hoc formatting) 2017-08-04 23:54:51 +01:00
Phil Nash
97d6b08087 Changed clock resolution estimator to return uint64_t 2017-08-04 21:31:28 +01:00
Phil Nash
a9b6813ad9 First draft of (experimental) benchmarking support 2017-08-04 19:23:30 +01:00
Phil Nash
a1e3f0b624 Moved Timer impl back to cpp
(I thought it wasn't included on the non-main path, but it is)
2017-08-04 13:53:47 +01:00
Phil Nash
39d37d9f34 Timer resolution is now nanoseconds 2017-08-04 12:22:16 +01:00
Phil Nash
c7028f7bc7 Made most of Timer class inline - and export getCurrentMicrosecondsSinceEpoch() 2017-08-04 12:16:05 +01:00
Phil Nash
5450de2acd Added some missing overrides and removed some virtuals from overrides 2017-08-04 12:13:58 +01:00
Martin Hořeňovský
3882ac1a19 Include proper exception header in enforce.h 2017-08-02 00:26:52 +02:00
Martin Hořeňovský
e8b785b177 Fixup bad merge in 2212cdfe 2017-08-02 00:04:26 +02:00
Anton Vorobyev
eab56d6656 Initial support for native IBM i ILE C++ (#976)
* - Initial support for native IBM i ILE C++

Signed-off-by: zeromem <zeromem2@gmail.com>
2017-08-01 22:49:27 +02:00
Neal Coombes
2212cdfe26 Eliminate some work when results won't be reported. 2017-08-01 22:49:27 +02:00
Fran García Salomón
4f72202c04 Fix for JUnit reporter when using dynamically generated sections (#963)
* BySectionInfo should also take into account the section name in addition to the source code line
2017-08-01 22:25:16 +02:00
Martin Hořeňovský
249bf116e8 Route all T* comparisons through const void* comparisons
This should stop the evaluate machinery from instantiating all the
templates for every ptr type that is compared, instead generating it
for single one.
2017-08-01 22:09:32 +02:00
Martin Hořeňovský
6d4673505d Add missing <algorithm> include in catch_approx.hpp 2017-08-01 22:02:00 +02:00
Martin Hořeňovský
85e14c5fb5 Move some compile-time dispatch to runtime
The runtime performance is likely to be negligible,
but compile times need every improvement they can get.
2017-08-01 21:58:09 +02:00
Martin Hořeňovský
feca97dfde Split out internal error macros from the common path 2017-08-01 18:46:33 +02:00
Martin Hořeňovský
c815ad1d53 Fix fwd declaration of IConfig in catch_test_case_registry_impl.hpp 2017-08-01 17:52:02 +02:00
Martin Hořeňovský
d4e796c138 Move Section(End)Info bodies to proper .cpp file 2017-08-01 17:51:32 +02:00
Martin Hořeňovský
7575749e56 Fix compilation error on older compilers 2017-08-01 17:21:06 +02:00
Martin Hořeňovský
8a2ff20982 Address some of the Resharper finds for Catch 1
Closes #957 as the other findings are mostly noise that is pointless
to fix in a branch that will be soon EoLd.
2017-07-31 12:31:45 +02:00
Anton Vorobyev
d3377c791d Initial support for native IBM i ILE C++ (#976)
* - Initial support for native IBM i ILE C++

Signed-off-by: zeromem <zeromem2@gmail.com>
2017-07-31 10:47:42 +02:00
Martin Hořeňovský
0a3f899d6a Move windows.h reduction logic into windows.h proxy header
Fixes #965 (at least the primary problem, the separate warnings can
be taken care of later)
2017-07-31 08:36:39 +02:00
Martin Hořeňovský
d08e31d89e Fix inverted CATCH_CONFIG_DISABLE_MATCHERS toggle 2017-07-29 08:43:32 +02:00
Martin Hořeňovský
0ca4cfb743 Introduce compile time toggle to remove Matchers from TU
The toggle is `CATCH_CONFIG_DISABLE_MATCHERS` and the only use is
to speed up compilation of small TUs. For large ones it is likely
insignificant, because the speed up is constant relative to
number of tests/assertions in TU.
2017-07-28 21:34:34 +02:00
Martin Hořeňovský
35c1301bd5 Fix missing CATCH_ prefixed macros 2017-07-28 21:04:18 +02:00
Martin Hořeňovský
d01fe03ba6 Removed <algorithm> include from the main path 2017-07-28 15:11:05 +02:00
Martin Hořeňovský
287cc92b2c Remove <set> include from the common test path 2017-07-27 22:31:27 +02:00
Martin Hořeňovský
446bad752f Move std::exception_ptr out of interfaces 2017-07-27 12:24:52 +02:00
Martin Hořeňovský
307eeefa8f Change typedefs to using 2017-07-27 12:24:21 +02:00
Martin Hořeňovský
33fd54a673 Split Option<T> and TagAlias definitions away from the main include path 2017-07-27 11:55:30 +02:00
Martin Hořeňovský
5ebbec7dab Move all stringref function bodies out of line 2017-07-27 11:32:04 +02:00
Martin Hořeňovský
a40add3153 Clean up Approx to take arguments by const& 2017-07-27 11:32:04 +02:00
Martin Hořeňovský
ab0f1dcde9 Remove superfluous include 2017-07-27 11:32:03 +02:00
Martin Hořeňovský
a75eaa3c5a Split out more headers into separate .cpp files 2017-07-27 11:32:02 +02:00
Martin Hořeňovský
9de729b515 General cleanup 2017-07-27 11:32:01 +02:00
Martin Hořeňovský
1a96175bb2 Split out helper functions on std::string from catch_common.h 2017-07-25 21:57:35 +02:00
Martin Hořeňovský
1e59ccee41 Addressed Resharper-C++ warnings
See #958
2017-07-25 17:16:28 +02:00
Martin Hořeňovský
b6f62af7d1 Address more of PVS studio warnings 2017-07-25 15:45:50 +02:00
Fran García Salomón
d65091fa06 Fix for JUnit reporter when using dynamically generated sections (#963)
* BySectionInfo should also take into account the section name in addition to the source code line
2017-07-23 17:13:44 +02:00
Phil Nash
46bf7605f4 Hold exception translators by unique_ptr
- and removed range deleters
2017-07-20 23:50:07 +01:00
Phil Nash
cb6963216f Removed catch_section_info.cpp (not used) 2017-07-20 23:49:03 +01:00
Phil Nash
c91639e1d7 Use Columns to format reporter list 2017-07-20 23:32:35 +01:00
Phil Nash
3a37f45a97 Removed tbc_text_format (superceded by TextFlow) 2017-07-20 23:20:42 +01:00
Phil Nash
6ec7709e07 removed final use of tbc_text_format (console reporter) 2017-07-20 23:13:08 +01:00
Phil Nash
224250e2d4 listTests now only uses TextFlow (not tbd_text_format) again 2017-07-20 20:10:13 +01:00
Phil Nash
5c3355ad1b Embed Clara with TextFlow fix for whitespace after newline 2017-07-20 20:07:28 +01:00
Phil Nash
b2a4dfcda4 Embedded version of Clara with TextFlow fix for embedded newlines 2017-07-20 19:42:06 +01:00
Phil Nash
f0890dcdf8 removed redundant virtuals on override functions (and added a couple of overrides) 2017-07-20 16:23:52 +01:00
Martin Hořeňovský
87a66b8479 Address results of PVS-Studio static analysis
Couple are left un-addressed, see #958 for details.
2017-07-20 00:27:28 +02:00
Martin Hořeňovský
2a586437e8 Fix merge mishap (duplicated catch_reporter_multi header) 2017-07-19 23:20:30 +02:00
Martin Hořeňovský
cf2678dce6 Merge branch 'dev-better-verbosity' of https://github.com/BMBurstein/Catch 2017-07-19 23:17:19 +02:00
Martin Hořeňovský
efd79aa0bd Extend exception type in _THROWS_ with const& unconditionally
Potentially breaking change, but most people apparently were using it
wrong and thus it won't be breaking for them.

Closes #955
2017-07-19 21:30:00 +02:00
Martin Hořeňovský
4a1e898eae More method bodies moved out of line 2017-07-19 15:32:58 +02:00
Martin Hořeňovský
d7ff62430a Removed superfluous inline specifications 2017-07-19 13:40:00 +02:00
Martin Hořeňovský
edbe122761 Split out non-templated Approx methods into cpp file 2017-07-19 13:40:00 +02:00
Martin Hořeňovský
7a22bad763 Addressed some static analysis warnings
Based on findings in #957
2017-07-19 09:50:08 +02:00
Phil Nash
0a614ee5ba re/moved some headers in catch_tostring 2017-07-19 08:31:10 +01:00
Phil Nash
4833932ab2 Removed redundant member 2017-07-19 08:17:41 +01:00
Phil Nash
cd6f6c021a Minor clean-ups in string conversion code 2017-07-19 08:16:55 +01:00
Phil Nash
b0e3f45a22 Replaced some uses of tbc_text_format with TextFlow (from Clara) 2017-07-18 20:27:42 +01:00
Phil Nash
d43024ff6b Removed intermediate IConfig ptr 2017-07-18 18:03:57 +01:00
Phil Nash
c7931f6f18 Reuse ostringstream in XML reporter 2017-07-18 08:35:41 +01:00
Phil Nash
01a21f67f7 Converted a load of spelt out iterators to auto 2017-07-18 08:08:17 +01:00
Martin Hořeňovský
7ccf11da29 Split out catch_run_context into cpp and hpp file 2017-07-15 16:48:21 +02:00
Phil Nash
cf6f9e3253 Initialise unexpectedExceptions in JUnitReporter 2017-07-13 10:10:39 +01:00
Phil Nash
f193698fb3 Removed all (that I could find) redundant second macro args to TEST_CASE and SECTION
- now we can rely on variadic macros
2017-07-13 09:20:37 +01:00
Phil Nash
d2d5910479 Suppress clang-tidy warnings about inline asm 2017-07-13 08:26:08 +01:00
Phil Nash
e01ed48a70 Made everything used in test case registration noexcept
- this prevents warnings about startup-time exceptions
2017-07-13 08:25:47 +01:00
Phil Nash
989222eceb Fixed up OcMethod base 2017-07-12 23:26:13 +01:00
Phil Nash
720fdf1d02 Simplified test case registration and started using StringRefs 2017-07-12 23:11:41 +01:00
Phil Nash
79627cdcdb Changed some names in test case registry
- in preparation for a bigger refactoring
2017-07-12 23:11:41 +01:00
Phil Nash
10c36aa74c added override keyword to overrides in compact reporter 2017-07-12 23:11:41 +01:00
Phil Nash
e3e6453229 Removed spurious "inline" (was causing linker errors) and fixed broken macOS detection 2017-07-12 15:24:35 +01:00
Martin Hořeňovský
878bd140e6 Removed superfluous inline keywords 2017-07-12 16:16:55 +02:00
Martin Hořeňovský
d8df83ee2f Don't rely on transitive <string> include 2017-07-12 16:07:52 +02:00
Martin Hořeňovský
8d8f481597 Moved couple function's bodies out of common-include path 2017-07-12 16:07:27 +02:00
Martin Hořeňovský
3f6c078173 Use = delete instead of private, unimplemented copy operations 2017-07-12 15:11:23 +02:00
Martin Hořeňovský
0bb9f52a99 Removed declared-but-undefined function 2017-07-12 15:10:55 +02:00
Martin Hořeňovský
91c1556078 Moved Catch NotImplementedException out of the common include path
We could probably toss it away completely, currently it is used
only by TeamCity reporter.
2017-07-12 15:05:01 +02:00
Martin Hořeňovský
4332b84c9b Moved leak detector to its own file 2017-07-12 15:03:52 +02:00
Martin Hořeňovský
9c318af987 Remove obsolete GENERATE macro 2017-07-12 14:46:49 +02:00
Phil Nash
8ebe94ca2e Added NOLINT annotations to selectively suppress clang_tidy warnings 2017-07-10 18:43:07 +01:00
Martin Hořeňovský
1d3bfa0353 More include and impl refactoring 2017-07-10 14:25:38 +02:00
Martin Hořeňovský
5f3f19de08 Default included reporters are now also in .cpp files
The non-default ones remain as header files.
2017-07-10 11:33:18 +02:00
Martin Hořeňovský
106d7e2a74 Initialize JunitReporter::unexpectedExceptions in constructor
This is not needed for correctness, but will prevent PVS warning
from triggering, and there is basically no performance difference.

Closes #951
2017-07-10 10:30:17 +02:00
Martin Hořeňovský
93f84b5b0d Modified generateSingleHeader script to work with .cpp files better
Also fixed the scripts to take into account renamed version file
2017-07-09 21:02:36 +02:00
Baruch Burstein
af05ccfe5d Merge remote-tracking branch 'upstream/dev-modernize' into dev-better-verbosity 2017-07-09 12:48:29 +03:00
Baruch Burstein
058b21e604 Previous implementation didn't work
It relied on calling a virtual method from a base constructer
2017-07-09 12:46:53 +03:00
Neal Coombes
a53ea30723 Eliminate some work when results won't be reported. 2017-07-07 01:34:12 +02:00
Martin Hořeňovský
fc32165d48 Started work on splitting out .cpp files from header files 2017-07-06 22:28:42 +02:00
Baruch Burstein
f749347523 Check that reporter supports requested verbosity 2017-07-06 01:25:49 +03:00
Baruch Burstein
bb9f2bb3ad Use new formatting capabilities 2017-07-04 18:16:42 +03:00
Baruch Burstein
694fe61ae3 Add ability to format any streamable class
This should probably be done at the source of this external file, but I couldn't find where that is. Perhaps it should be mentioned in the file header comment?
2017-07-02 11:52:29 +03:00
Phil Nash
0016362f69 explicit conversion from size_t to size_type 2017-06-29 16:31:05 +01:00
Phil Nash
63a8017ba7 Minor session tweaks 2017-06-29 14:27:53 +01:00
Phil Nash
03afbdfec9 Made more of StringRef noexcept 2017-06-29 11:47:09 +01:00
Phil Nash
78e7994435 Added string classes 2017-06-29 11:18:14 +01:00
Phil Nash
4c1880b35f Clamp exit code internally, so it doesn’t have to be done in every main() implies 2017-06-27 11:37:50 +01:00
Martin Hořeňovský
ee67ac6b7c v1.9.6 2017-06-27 12:21:48 +02:00
Martin Hořeňovský
fae0fa4ec1 Merge branch 'dev-second-string-argument-removal' into dev-modernize
It is no longer true that an assertion macro has either 1 or 2 args,
so...
2017-06-26 20:48:41 +02:00
Martin Hořeňovský
c5bac73cad Merge branch 'master' into dev-modernize
This includes the performance commits done recently
2017-06-26 19:08:42 +02:00
Baruch Burstein
1e7000ed55 Merged implemention of #934, but using 'verbose' option on command line instead.
(see 616f7235ef on master for original merge)
2017-06-26 17:15:28 +01:00
Martin Hořeňovský
7bcfdf8e94 Disable deprecation warning of std::uncaught_exception
We might prefer to use `std::uncaught_exceptions` in the future, but I
would prefer not to bring in more configuration into Catch Classic

Closes #927
2017-06-26 16:50:23 +01:00
Martin Hořeňovský
8d5f6c8e2e Fix how GCC version is detected when checking for __COUNTER__
Fixes #928
2017-06-26 16:49:34 +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
Phil Nash
059a33d555 Fixed indentation 2017-06-26 16:47:40 +01:00
Baruch Burstein
8a14af701e If --list-extra-info is specified with --list-test-names-only, only output one list 2017-06-25 17:12:29 +02:00
Martin Hořeňovský
07c6bfc3b9 --extra-info -> --list-extra-info, behaves like other --list-* flags 2017-06-25 17:12:29 +02:00
Baruch Burstein
616f7235ef add --extra-info flag
this will add line info to test lists, and test descriptions to the long
form of the test list
2017-06-25 17:12:29 +02:00
Neal Coombes
396ecf6021 Cache std::ostringstream between assertions.
This is not thread safe, but I think that was already true of Catch.
The construction/destruction of the std::ostringstream is where the
vast majority of time is spent per assertion.  A simple test of
100000000 CHECK()s is reduced from around 60s to 7.4s
2017-06-25 15:53:59 +02:00
Phil Nash
af66106500 Updated Clara with handling for / on Windows 2017-06-23 09:08:44 +01:00
Martin Hořeňovský
0eb101e165 Remove "second argument" from result builder and assertion result
This is not quite complete removal (it doesn't pass approval tests),
but it should be representative of full perf improvements from doing so
2017-06-22 18:13:05 +02:00
Neal Coombes
dcab8a5971 Performance improvement in AssertionInfo.
By using char const * instead of std::string we avoid significant
copying per assertion.  In a simple loop with 10000000 CHECKS on
my system, this reduces the run time from 9.8s to 6s.
2017-06-22 18:03:47 +02:00
Phil Nash
2462dff088 Updated Clara with VS ICE workaround 2017-06-22 16:07:05 +01:00
Phil Nash
0470b300a8 Reverted previous two commits as they didn’t fix anything 2017-06-22 15:53:24 +01:00
Phil Nash
3bb16e8418 Reorganised CLI again in another attempt to get past VS ICEs 2017-06-21 11:42:53 +01:00
Phil Nash
e0c6c4aee7 Another attempt to fix VS ICEs - split cli parser up. 2017-06-21 09:40:52 +01:00
Phil Nash
c43d5f673f Moved command line lambdas out-of-line in an attempt to fix VS ICEs 2017-06-21 08:54:53 +01:00
philsquared
d81c1eb006 added version of Clara that has virtual destructors
(just to silence warnings - they are not actually needed)
2017-06-20 22:35:35 +01:00
Phil Nash
da5964af78 Updated version of Clara (should fix Windows compile issues)
- embedded using new embed script
2017-06-20 18:03:47 +01:00
Martin Hořeňovský
017a63da62 v1.9.5 2017-06-15 13:08:26 +02:00
Martin Hořeňovský
b90d0b7267 Disable deprecation warning of std::uncaught_exception
We might prefer to use `std::uncaught_exceptions` in the future, but I
would prefer not to bring in more configuration into Catch Classic

Closes #927
2017-06-15 11:43:31 +02:00
Martin Hořeňovský
ee0defb939 Silence unused argument warning in Catch 2017-06-15 11:34:29 +02:00
Martin Hořeňovský
efba988ccc Fix how GCC version is detected when checking for __COUNTER__
Fixes #928
2017-06-13 18:20:59 +02:00
Phil Nash
e62b3beef4 Fixed issue with different result types in Clara 2017-06-13 08:29:56 +01:00
Phil Nash
1c223b63ba Integrated (all) new version of Clara 2017-06-12 23:07:10 +01:00
Phil Nash
004228efb2 Merge pull request #855 from kainjow/objc-tostring-link
Fix Catch::toString() linker error when main() is compiled as C++
2017-06-11 23:06:38 +01:00
Martin Hořeňovský
ebb3371cbf Merge remote-tracking branch 'tsondergaard/improve-junit-xml-for-jenkins' into dev-modernize 2017-06-06 16:52:02 +02:00
Martin Hořeňovský
6583284731 Fix erroneous result disposition for {REQUIRE,CHECK}_THAT
This fixes result disposition being ContinueOnFailure |
ContinueOnFailure for CHECK_THAT (obviously an error) and Normal |
ContinueOnFailure for REQUIRE_THAT (less obviously an error, but worse,
as that signals to the pipeline that assertion failure should both abort
and continue the test with ???? happening).
2017-06-06 15:12:03 +02:00
Martin Hořeňovský
47eb9b3d68 Fix #914 being removed during last merge 2017-06-06 15:07:34 +02:00
Martin Hořeňovský
950cae9040 Added new assertion macros: *_THROWS_WITH
It combines `*_THROWS_AS` and `*_THROWS_WITH` macros, so that the
exception type matches expectetations and its contents match a specific
matcher.
2017-06-05 18:40:50 +02:00
Martin Hořeňovský
7f6773bb4d Merge branch 'master' into dev-modernize
Hopefully nothing went too wrong.
2017-06-05 17:19:42 +02:00
Martin Hořeňovský
1e16be0b9e Purge deprecated generators 2017-06-05 16:49:10 +02:00
Thomas Sondergaard
69ff7fcf42 Include suite name in junit classname attrib for grouping in jenkins
Jenkins groups junit test results by loosely interpreting the
classname attribute of the <testcase> element as a package-qualified
java class name such as java.util.String. It ignores the <testsuite>
elements in the xml. To organize test results we therefore need to
embed the suite name in the classname attribute as if it was a java
package name.

Fixes #922.
2017-06-05 12:51:56 +02:00
Thomas Sondergaard
a6b03031ba Use [#filename] tag for junit testcase classname attribute
If [#filename] is present in tags, use it for the classname attribute,
rather than "global". If the test fixture is present that still takes
precedence.
2017-06-05 12:51:56 +02:00
Martin Hořeňovský
47c8994a61 Inherit from NonCopyable to disable RegisterHub copies 2017-06-04 22:56:57 +02:00
Martin Hořeňovský
860de28b8d Catch and register startup exceptions in autoregistrars
Previously they were registered where they would be thrown otherwise
2017-06-04 22:37:59 +02:00
Martin Hořeňovský
da0edcbe25 Collect startup exceptions instead of throwing them
Previously, some errors in Catch configuration would cause exceptions to
be thrown before main was even entered. This leads to call to
`std::terminate`, which is not a particularly nice way of ending the
binary.

Now these exceptions are registered with a global collector and used
once Catch enters main. They can also be optionally ignored, if user
supplies his own main and opts not to check them (or ignored them
intentionally).

Closes #921
2017-06-04 21:39:27 +02:00
Martin Hořeňovský
adb66f55a7 Don't include warning headers from catch_xmlwriter.hpp
This prevents Catch from disabling `Wpadded` for Clang inside test files
(files that do not define either `CATCH_CONFIG_MAIN` or
`CATCH_CONFIG_RUNNER`).

catch_suppress_warnings.h and catch_reenable_warnings.h should be
included only once*, so that the stitching script includes them as the
first and last header respectively, since it only includes each header
once. This caused a bug, where the first one was included properly, but
the second one was included prematurely, from catch_xmlwriter.hpp, and
thus was guarded by `CATCH_IMPL`.

* At least until the stitching script is changed to accomodate common
warning disabling header.

Fixes #871
2017-06-02 19:10:57 +02:00
Thomas Sondergaard
a64a0c6f06 Consistent junit reporting regardless of internal SECTIONS
Change it so the classname attribute on the <testcase> element is the
test fixture name or "global" regardless of whether the TEST_CASE
contains SECTIONs. This way the output is not changed substantially,
just because a SECTION is added to a TEST_CASE.
2017-05-30 17:10:14 +02:00
Martin Hořeňovský
377c9a746d Cosmetic fixes (whitespace and spelling) 2017-05-27 14:42:54 +02:00
twhittock
2d1739b429 ExpressionLhs reconstruction based on value, not truthiness (#914)
Types which are truthy, but have more information than the truthiness in their string conversion were showing up as 'true' or 'false' instead of showing the underlying type's string value.
2017-05-27 14:09:43 +02:00
Martin Hořeňovský
169e260e8b Enable colourized output while in debugger 2017-05-22 00:41:31 +02: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ý
0bb8e1247e Merge branch 'master' of https://github.com/awglyde/Catch 2017-05-16 16:09:51 +02:00
Martin Hořeňovský
3dcc923351 v1.9.4 2017-05-16 13:59:29 +02:00
Martin Hořeňovský
589c40077b Typo fix
Somehow I made that in 5ffc8a84cd without noticing
2017-05-16 13:51:17 +02:00
Antonio Di Monaco
b8443e67da Added Win32 UNICODE wmain support (#903)
* Added wmain support
* Added appveyor.yml wmain configuration
* Added wmain configuration flag to CMake
2017-05-11 13:00:03 +02:00
Martin Hořeňovský
f82e312552 Attempt at fixing compilation on OSX
Since I don't have actual access to OSX, this might be a tad optimistic.
2017-05-08 01:08:07 +02:00
Martin Hořeňovský
bffef1bffa Fix alignment for Catch::Option
This is so much easier in C++11...
2017-05-08 00:59:44 +02:00
Martin Hořeňovský
7e14232924 Fix C4702 (unreachable code) in generators
Generators might get removed anyway, but at least compilation wont
trigger Wx on MSVC in the meantime.
2017-05-08 00:58:44 +02:00
Martin Hořeňovský
d7eb041ab5 Fix compilation on non-OSX platforms 2017-05-08 00:54:53 +02:00
Phil Nash
8c757cc542 Removed need for Error class to capture stream inserted strings into exceptions 2017-05-05 18:39:49 +01:00
Phil Nash
4c5af2089a Added CATCH_ENFORCE (and updated CATCH_INTERNAL_ERROR to be stream based)
replaced all ad-hoc exceptions (where appropriate) with CATCH_ENFORCE or CATCH_INTERNAL_ERROR - no explicit ostringstreams.
2017-05-05 15:43:31 +01:00
Phil Nash
687437fcd1 converted IStreamingReporter to unique_ptr 2017-05-05 15:43:31 +01:00
Phil Nash
ef8b72c949 Changed dynamic_pointer_casts to static_pointer_casts 2017-05-05 15:43:31 +01:00
Martin Hořeňovský
a9128d0fac More macros are now variadic
Also added tests for them
2017-05-03 19:10:27 +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ý
b819432271 Don't clear out all messages upon printing an assertion.
Previously, this would not print out any messages for the last CHECK
```cpp
TEST_CASE("Foo") {
INFO("Test case start");
for (int i = 0; i < 2; ++i) {
INFO("The number is " << i);
CHECK(i == 0);
}
CHECK(false);
}
```

now it does.
2017-04-29 17:50:03 +02:00
Martin Hořeňovský
40130e59b4 Fix order of arguments in CATCH_FAIL macro 2017-04-28 18:33:52 +02:00
Martin Hořeňovský
5ffc8a84cd Fix order of arguments in CATCH_FAIL and nonvariadic INTERNAL_CATCH_MSG
Fixes #896
2017-04-28 18:30:04 +02:00
Phil Nash
316cb28ea8 Added missing <memory> includes 2017-04-26 17:04:00 +01:00
Phil Nash
d17d94e45d Made INTERNAL_CATCH_TEST variadic so commas in assertions work 2017-04-26 16:10:18 +01:00
Phil Nash
8ccbf63f28 Removed Ptr, Shared and SharedImpl 2017-04-25 21:56:14 +01:00
Phil Nash
e6094a9503 migrated (Reporter) Nodes to std::shared_ptr 2017-04-25 21:56:14 +01:00
Phil Nash
851e40a4bb migrated Pattern to std::shared_ptr 2017-04-25 21:56:14 +01:00
Phil Nash
0807a6910f migrated ITracker to std::shared_ptr 2017-04-25 21:56:14 +01:00
Phil Nash
44cccde8b9 Migrated ITestCase to std::shared_ptr 2017-04-25 21:56:14 +01:00
Phil Nash
0844d6e867 Migrated IStreamingReporter from Ptr to std::shared_ptr 2017-04-25 21:56:14 +01:00
Phil Nash
a96f25c716 Some listener and factory clean-ups 2017-04-25 21:56:14 +01:00
Phil Nash
dd78824697 Migrated IReporterFactory to std::shared_ptr 2017-04-25 21:56:14 +01:00
Phil Nash
338ba6b9ba Migrated Config and IConfig to shared_ptr (from Ptr) 2017-04-25 21:56:14 +01:00
Phil Nash
41afd0c3d4 Removed copy ctor, assignment operator and swap from TestCaseInfo 2017-04-25 21:56:14 +01:00
Phil Nash
602b62f037 Removed legacy reporter support 2017-04-25 21:56:14 +01:00
Phil Nash
e749724a11 A load more C++11 tweaks - mostly moving initialisations from constructors to inline 2017-04-25 19:30:53 +01:00
Phil Nash
cc8206f4c3 Removed SafeBool 2017-04-25 19:30:53 +01:00
Martin Hořeňovský
e1bca7017d Most of Assertion macros are now variadic
This means that `REQUIRE(std::vector<int>{1, 2} == std::vector<int>{1,
2});` works as expected.

Note that assertion macros taking more than 1 argument are currently not
variadic, because variadic args have to come last, which would make the
interface of these ugly: `REQUIRE_THROWS_AS(std::exception const&, ....
)`
2017-04-25 20:20:46 +02:00
Phil Nash
be0fc60c07 Updated version number for v2 development and removed single include (for now). 2017-04-25 14:43:13 +00:00
Phil Nash
a0ada2e935 v1.9.3 2017-04-25 14:23:06 +00:00
Phil Nash
e4694f58da Removed errant uses of uint64_t
fixes #894
2017-04-25 14:15:59 +00:00
Phil Nash
79650e44f4 Removed more C++98/03 compatibility 2017-04-25 12:40:52 +01:00
Phil Nash
5c8ea03cc8 Removed debug break support for PowerPC Macs 2017-04-25 12:27:26 +01:00
Phil Nash
242022460d Use std::chrono for Timer to eliminate platform dependency 2017-04-25 12:24:34 +01:00
Phil Nash
67005d290c Removed more redundant compatibility stuff from timer 2017-04-25 12:13:16 +01:00
Martin Hořeňovský
71df66365e Gutted catch_compiler_capabilities
All C++11 toggles are now removed. What is left is either platform
specific (POSIX_SIGNALS, WINDOWS_SEH), or possibly still needed
(USE_COUNTER).

If current CLion is compatible with `__COUNTER__`, then we should also
force `__COUNTER__` usage.

Changed
* CATCH_AUTO_PTR    -> std::unique_ptr
* CATCH_OVERRIDE    -> override
* CATCH_NULL        -> nullptr
* CATCH_NOEXCEPT    -> noexcept
* CATCH_NOEXCEPT_IS -> noexcept

Removed
* CATCH_CONFIG_CPP11_UNIQUE_PTR
* CATCH_CONFIG_CPP11_SHUFFLE
* CATCH_CONFIG_CPP11_TYPE_TRAITS
* CATCH_CONFIG_CPP11_OVERRIDE
* CATCH_CONFIG_CPP11_LONG_LONG
* CATCH_CONFIG_CPP11_TUPLE
* CATCH_CONFIG_CPP11_IS_ENUM
* CATCH_CONFIG_CPP11_GENERATED_METHODS
* CATCH_CONFIG_CPP11_NOEXCEPT
* CATCH_CONFIG_CPP11_NULLPTR
* CATCH_CONFIG_VARIADIC_MACROS
2017-04-25 12:43:19 +02:00
Phil Nash
1f3ba8a0b6 Converted (almost) all for-loops with iterators or indices to range-based 2017-04-25 11:07:02 +01:00
Martin Hořeňovský
6a09425de1 Remove C++98 backcompat from evaluate 2017-04-25 11:28:40 +02:00
Martin Hořeňovský
c6e5738d54 Remove c++98 backcompat from timer 2017-04-25 11:25:49 +02:00
Martin Hořeňovský
c6980ec2d8 Remove C++98 backcompat from toString 2017-04-25 11:21:22 +02:00
Martin Hořeňovský
7c900660ef Removed superfluous reimplementation of type traits 2017-04-25 11:19:01 +02:00
Martin Hořeňovský
2fdd81a33f Removed C++98 backcompat from Approx
Now it always uses type traits to work with all types convertible to
double
2017-04-25 11:11:26 +02:00
Martin Hořeňovský
fc7f0a02b8 v1.9.2 2017-04-25 11:08:02 +02:00
Phil Nash
211b330346 Don’t unconditionally #include <stdint.h> (as earlier MSVC don’t have it) 2017-04-25 08:43:14 +01:00
Phil Nash
d36fe214a6 Further tweaked alignment hack for Option 2017-04-25 08:38:25 +01:00
Martin Hořeňovský
a34c053f0a All of Approx's member functions now accept strong typedefs
Previously `Approx::operator()`, `Approx::epsilon`, `Approx::margin` and
`Approx::scale` didn't.

Closes #888
2017-04-24 22:01:45 +02:00
Phil Nash
eedcc82d31 Tweaked storage alignment "workaround" a bit more in Option. 2017-04-21 07:19:39 +01:00
Martin Hořeňovský
b95163bd3a Don't enable POSIX signals under QNX
Fixes #889
2017-04-20 21:02:25 +02:00
Phil Nash
2809be87cc “fixed” alignment in Option 2017-04-20 14:39:07 +01:00
Phil Nash
e5c5a636a9 junit reporter does not count exceptions as failures if ok-to-fail 2017-04-11 15:47:42 +01:00
Phil Nash
2bf30e9e5a Use (locally defined) UInt64 instead of uint64_t
- typedefs long long for MSVC
- typedefs uint64_t otherwise

Should probably do finer grained compiler checking - but this should at least be better than what was there before
2017-04-11 15:06:25 +01:00
Martin Hořeňovský
c6990cdf91 v1.9.1 release 2017-04-09 21:25:20 +02:00
Martin Hořeňovský
da8786b8fd Unexpected exception are no longer ignored by default
What an embarassing bug, I'll have to look into why it wasn't caught by
any of Catch's self-tests.

Fixes #885 and closes #887 (duplicate)
2017-04-09 21:20:58 +02:00
Martin Hořeňovský
1b03c5ab6a v1.9.0 release 2017-04-07 22:56:36 +02:00
Phil Nash
29d26d3179 Commented out unused argument 2017-04-07 11:36:54 +01:00
Phil Nash
ca764ec8d9 TeamCity reporter “ignores” failures in tests marked “ok to fail”
- also don’t report hidden/ not-selected tests
2017-04-07 11:15:37 +01:00
Martin Hořeňovský
8f85d08e9f Give up on _Pragma for gcc, force disable Wparentheses in all TUs 2017-04-05 21:37:27 +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
Martin Hořeňovský
0354d50278 Added templated constructor to C++11 Approx
When using C++11, comparison operators are already templated to take
anything that can be explicitly converted to double, but constructor
took only doubles. This lead to warnings when an `Approx` was
constructed from floats, which was problematic for some users.

Since just adding float constructor would be a large breaking change, as
suddenly `Approx( 1 )` would become ambiguous, I added a templated
constructor that will take anything that is explicitly convertible to
double. This has the added benefit of allowing constructing `Approx`
instances from instances of strong typedefs, ie allowing
`calculated_temp == Approx( known_temp)`.

Closes #873
2017-04-04 15:19:15 +02:00
Martin Hořeňovský
cdd83c2e15 Fmt and tag fixup for #876
Github wouldn't let me push to the PR, probably because it was made from
fork of a fork...
2017-04-04 11:31:13 +02:00
dvirtz
9a07dde16d print messages when unexpected exceptions are thrown 2017-04-04 11:27:19 +02:00
Martin Hořeňovský
6e091d3991 Reset the UnexpectedException report state 2017-04-03 11:48:50 +02:00
Martin Hořeňovský
95d85fb186 Fixed up CATCH_CONFIG_FAST_COMPILE for REQUIREs
Unexpected exceptions no longer cause abort and there should be no more
potential for false negatives.

The trade-off now is that exceptions are no longer translated.
2017-04-03 11:36:55 +02:00
Martin Hořeňovský
4fe2432e05 Rework of REQUIRE* changes in CATCH_CONFIG_FAST_COMPILE
`ResultBuilder`s destructor now checks for exceptions, preventing false
negatives. The speedup should remain the same give or take a tiny bit.
2017-03-29 21:12:06 +02:00
Martin Hořeňovský
c3a41e26a7 Suppress -Wexit-time-destructors in Catch code
This is another warning that follows test macros, making it painful to
suppress without leaking outside. Luckily clang's `_Pragma`
implementation works.

Should fix #308
2017-03-29 20:30:59 +02:00
Martin Hořeňovský
f23b6b8b85 Don't sanitize exception type in REQUIRE_THROWS_AS
Effectively a revert of previous commit, fixing #542, where this was
added to stop linters complaining about `REQUIRE_THROWS_AS` used like
`REQUIRE_THROWS_AS(expr, std::exception);`, which would be slicing the
caught exception. Now it is user's responsibility to pass us proper
exception type.

Closes #833 which wanted to add `typename`, so that the construct works
in a template, but that would not work with MSVC and older GCC's, as
having `typename` outside of a template is allowed only from C++11
onward.
2017-03-23 21:11:21 +01:00
Martin Hořeňovský
4597b43912 Throw instead of calling exit in RegistrarForTagAliases constructor
Caries a problem vis-a-vis Windows, just like previous commit, but that
can be fixed later on.

Closes #866
2017-03-22 18:40:07 +01:00
Martin Hořeňovský
f64d914bff Throw instead of calling exit in enforceNotReservedTag
Closes #865
2017-03-22 17:53:22 +01:00
Martin Hořeňovský
d07999ddff Version struct now uses char* for holding branch name
Since the info is constant, and the only use is to write it out during
runtime, there is no need for `std::string`.
2017-03-22 17:45:36 +01:00
Kevin Ushey
e04dc5105b use inline 'libraryVersion()' function (closes #858) 2017-03-22 15:51:02 +01:00
Phil Nash
f3ec843ba6 Changed all internal forwarding macro usages to put macro name as first argument
(and ‘expression’, if any, last)
This is a first step towards allowing expression arguments to become variadic
2017-03-21 13:23:35 +00:00
Martin Hořeňovský
55ed17f97b Removed stray define 2017-03-20 10:53:32 +01:00
Martin Hořeňovský
7a8a0205b4 CATCH_CONFIG_FAST_COMPILE now disables trys in REQUIRE*
This seems to give about 15% speedup when compiling tests using GCC.

The tradeoff is that under certain circumstances, there is a chance for
false negative result, when the expression under test throws exception
and the test code catches it before it gets to the test runner.

Example:
``` cpp
TEST_CASE("False negative") {
try {
REQUIRE(throws() == "");
} catch (...) {}
}
```
This test case will succeed, reporting no assertions checked, instead of
failing as it would with `CATCH_CONFIG_FAST_COMPILE` disabled. However,
just removing the try-catch block inside client's code will fix this, so
it is worthwhile.

This change does not apply to CHECK* macros, because these are currently
specified as continuing on exception and thus need the local try-catch
to work as intended.
2017-03-17 13:21:40 +01:00
Mickey Rose
4dc06bdb70 Use bulk vector::insert rather than back_inserter 2017-03-15 15:19:38 +00:00
Phil Nash
4ec8d53e91 Tag Alias registry is part of registry hub instead of it’s own singleton
- should now be cleaned up properly
2017-03-15 09:45:37 +00:00
Kevin Wojniak
e8b31108d6 Fix Catch::toString() linker error when main() is compiled as C++
Fixes #278
2017-03-14 11:54:14 -07:00
Martin Hořeňovský
0c015aa887 v1.8.2 release 2017-03-13 21:29:30 +01:00
Phil Nash
0afd52b98d Fix Objective-C Matchers
Fixes #854
2017-03-13 15:40:21 +00:00
Phil Nash
38b05f1400 Don’t assume first CL arg (exe name) is present
Fixes #729
2017-03-13 11:00:58 +00:00
Phil Nash
db9866677e Don’t ref past end of string
fixes #830
2017-03-13 10:22:02 +00:00
Phil Nash
4101ff314a #include <ctype> for std::to lower 2017-03-10 19:25:00 +00:00
Phil Nash
e4a25ad5ff Added CATCH_REGISTER_LISTENER without the INTERNAL_ prefix 2017-03-10 19:15:03 +00:00
Phil Nash
5d6c744d38 Qualified std::tolower in Clara.
Fixes #543
2017-03-10 18:38:52 +00:00
Phil Nash
5dd0639520 Added FAIL_CHECK
Works like FAIL, but does not abort test.
As proposed in #765
2017-03-08 15:42:11 +00:00
Martin Hořeňovský
ace70407a2 Add tests for #835
Also add ErrnoGuard before `isatty` call, because apparently it can set
errno to 25 (ENOTTY).
2017-03-06 22:07:33 +01:00
Martin Hořeňovský
613e1466f9 Save errno before using sprintf, ifstream.
std::ifstream in libstdc++ contains a bug, where it sets errno to zero.
To work around it, we manually save the errno before using std::ifstream
in debugger check, and reset it after we are done.

We also preventively save errno before using sprintf.

Fixes #835
2017-03-06 21:51:22 +01:00
Alex Glyde
d8f45cd5f1 changing tabs to spaces 2017-03-06 10:55:00 -05:00
Alex Glyde
3afd077b55 teamcity reporter should time durations explicitly 2017-03-06 10:35:03 -05:00
Martin Hořeňovský
e95bf48445 Take std::string by const-ref where possible
Most places already do, this brings over some forgotten places.

Also close #842
2017-03-06 13:16:43 +01:00
Phil Nash
041498b221 Fixed unintentional tabs 2017-03-06 09:23:31 +00:00
philsquared
d5a5883a10 Fixed mssing virtual destructor warnings
In Visual Studio with warning 4265 enabled
Closes #844
2017-03-06 08:59:52 +00:00
Phil Nash
f9db24a824 Refactored console reporter include logic to match Xml Reporter’s 2017-03-03 14:19:41 +00:00
Phil Nash
9bee606dd6 Tweaked Xml Reporter to follow same success/ info behaviour as Console reporter 2017-03-03 14:12:47 +00:00
Martin Hořeňovský
be4f6ab8e1 Change reporting of CAPTURE'd variables
Info is not changed, intentionally.

Closes #639
2017-03-03 14:34:50 +01:00
Martin Hořeňovský
cd6de9cd34 Don't reconstruct expression on encountering fatal error
In some cases, like when given

```cpp
std::vector<char>* str =
reinterpret_cast<std::vector<char>*>(0x1234458);
CHECK(*str == std::vector<char>());
```

reconstructing the expression to report it would cause another fatal
error. Instead we just put together an AssertionResult without
reconstructing the expression fully.

This should fully fix #810
2017-03-02 18:18:28 +01:00
Martin Hořeňovský
40f6a5b8a4 Added duration reporting to compact reporter
Also made the duration formatting code available to all reporters.

Closes #780
2017-03-02 16:16:17 +01:00
Martin Hořeňovský
95b0eb2b6c TAP reporter now behaves as if -s was always set
This should fulfill the TAP specification better.
2017-03-02 15:54:08 +01:00
Martin Hořeňovský
0b28d3daf2 Merge branch 'tap-count-success' of https://github.com/gahr/Catch 2017-03-02 15:23:46 +01:00
Phil Nash
c6535a080e v1.8.1 release 2017-03-01 16:04:44 +00:00
Phil Nash
673ec550f5 Moved definition of _BSD_SOURCE earlier 2017-03-01 15:59:10 +00:00