Commit Graph

62 Commits

Author SHA1 Message Date
Martin Hořeňovský
878bd140e6 Removed superfluous inline keywords 2017-07-12 16:16:55 +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ý
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ý
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
cc8206f4c3 Removed SafeBool 2017-04-25 19:30:53 +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
Phil Nash
7fed25ad1f New Matchers implementation
- simpler
- less templates and machinery
- no cloning, copying or unnecessary heap allocations
- better factored
2017-02-14 09:16:54 +00:00
Phil Nash
67d513aa73 Removed single char contains()
- had incorrect prototype anyway
2017-02-13 08:20:45 +00:00
Martin Hořeňovský
9012f95964 Moved some std includes out from catch_common.h 2017-02-12 12:17:07 +01:00
Martin Hořeňovský
d0620c3495 Added std:: qualification to some functions from C stdlib
This should solve #543, once Clara changes are in as well.
2017-02-11 23:20:09 +01:00
Martin Hořeňovský
615aa071a8 Merge branch 'dev-performance-round2' 2017-01-30 13:02:48 +01:00
Martin Hořeňovský
15816c5760 Revert "use sizeof(expr) for unevaluated syntax check"
Using sizeof(expr) can trigger a compile-time error,
"lambda expressions are not allowed in an unevaluated context", when passing
expression containing lambda, like a std algorithm. This error is considered
a standard defect, as it is meant to prevent lambdas in decltype
or templates, but not in sizeof.

This reverts commit 227598af47.
2017-01-30 11:56:29 +01:00
Martin Hořeňovský
60f8ebec49 Use const char* for filename in SourceLineInfo
This is sane, because those `const char*`s are given to us by compiler,
from the text area and thus we do not have to manage their lifetimes. We
also never want to change them.

Also moved copy constructor to compiler-generated methods, not sure why
it wasn't -- even before it was the same as a compiler would generate.
2017-01-29 22:03:27 +01:00
Martin Hořeňovský
4ce11d63a6 Merge branch 'dev-performance' 2017-01-25 22:56:36 +01:00
Mickey Rose
227598af47 use sizeof(expr) for unevaluated syntax check 2017-01-19 21:25:27 +01:00
Martin Hořeňovský
3b98a0166f Various small string usage performance improvements.
* Empty strings are now direct constructed as `std::string()`, not as empty string literals.
* `startsWith` and `endsWith` no longer construct new a string. This should be an improvement
for libstdc++ when using older standards, as it doesn't use SSO but COW and thus even short
strings are expensive to first create.
* Various places now use char literal instead of string literals containing single char.
** `startsWith` and `endsWith` now also have overload that takes single char.

Generally the performance improvements under VS2015 are small, as going from short string
to char is mostly meaningless because of SSO (Catch doesn't push string handling that hard)
and previous commit removed most string handling if tests pass, which is the expect case.
2017-01-15 10:05:01 +01:00
Phil Nash
b68e8f9a24 Added missing #include so CATCH_CONFIG_COUNTER properly takes into account the current compiler.
May address #677 and #435 and others.
2017-01-11 16:27:16 +00:00
Phil Nash
13a887ad24 Use __COUNTER__ when generating unique names instead of __LINE__, if available.
Based on PR #351
2016-03-14 07:55:00 +00: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
72868920bb Exception message assertions now work with matchers 2015-07-15 23:02:25 +01:00
Phil Nash
d87e551efa reseeds rng before each test case and provides access to seed through Catch::rngSeed() function 2015-07-02 23:02:35 +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
5eb7748a55 Changed relative #includes and made SourceLineInfo sortable (added < op) 2015-03-04 07:17:12 +00:00
Phil Nash
458b3ae257 Fixed replace(inPlace) function
and added tests (should have done that in the first place - I'll never learn!)
2014-12-19 18:16:19 +00:00
Phil Nash
12fe67cc82 Updated NonCopyable (to include C++11 version) and use for Session and Section 2014-10-03 08:15:27 +01:00
Phil Nash
9438a03d5b Big assertion capture refactoring.
- moved as much logic out of the macros as possible
- moved most logic into new ResultBuilder class, which wraps ExpressionResultBuilder (may take it over next), subsumes ResultAction and also takes place of ExpressionDecomposer.

This introduces many SRP violations - but all in the name of minimising macro logic!
2014-05-28 18:53:01 +01:00
Phil Nash
d7e1790347 Merge branch 'master' of https://github.com/gnzlbg/Catch
# By gnzlbg
# Via gnzlbg
* 'master' of https://github.com/gnzlbg/Catch:
  Conditionally removes usage of deprecated features

Conflicts (resolved):
	include/internal/catch_common.h
	include/internal/catch_section.hpp
2014-04-18 08:49:35 +01:00
gnzlbg
ce6598599b Conditionally removes usage of deprecated features
-add macros to test for C++ version and features
to catch_compiler_capabilities.hpp
- replaces dynamic exception specifications (deprecated)
with noexcept in C++ Version >= 11
- defines defaulted copy constructor/move constructors/assignment
in C++ Version >= 11 since their implicit generation is deprecated
under some circumstances.
- fixes #259
2014-03-20 14:03:51 +01:00
Phil Nash
274ed3ea76 Allow FAIL() to be empty 2013-12-12 23:02:31 +00:00
Phil Nash
a1e87a4b7d trim test/ section names in xml reporter
- BDD-style test names have leading spaces for alignment in the console reporter
2013-12-10 08:20:46 +00:00
Phil Nash
87b20e8dab SourceLineInfo takes char*s instead of std::strings 2013-12-04 08:12:30 +00:00
Phil Nash
c4a089c12b Refactored a lot of code from headers into impl headers only compiled into one TU
- also added noimpl option to single header script - which only generates the non impl code
2013-12-03 18:52:41 +00:00
Phil Nash
2ddb9d3802 Completed CumulativeReporterBase and reimplemented JUnitReporter in terms of it 2013-08-15 18:39:55 +01:00
Phil Nash
f3d1f08c3b Removed all trailing whitespace
- addresses #105
2013-07-03 19:14:59 +01:00
Phil Nash
bf37e6879a Removed use of compiler specific techniques for denoting non-returning functions
- use if( Catch::isTrue( true) ) to guard throws instead
2013-04-23 20:52:49 +01:00
Phil Nash
2a9d8d9e36 Changed "const X ref"s to "X const ref"s
- Brought older code up to current convention (with the help of a Python script)
2013-04-23 18:58:56 +01:00
Phil Nash
2c90533a26 More formatting/ colour tweaks 2013-04-01 11:25:54 +01:00
Phil Nash
6ba2057abd refactored toLower 2013-03-22 19:00:42 +00:00
Phil Nash
17479c6e49 Tag and test case name querying are now case insensitive 2013-03-12 18:47:53 +00:00
Phil Nash
e57a56bb28 Converted tabs to spaces in some files where they have crept back in 2013-03-08 09:26:20 +00:00
Phil Nash
3682433c2f console_reporter refactoring 2013-01-18 17:50:21 +00:00
Phil Nash
42aef1d99c Fairly major reworking of console reporter (still in progress).
Changed reporter interface a bit.
2013-01-13 21:51:44 +00:00
Phil Nash
6f2343bf64 Sections use vector instead of a map
Uses brute-force search, but only ever for small vectors
2012-11-29 09:17:08 +00:00
Phil Nash
81cb69ef18 AssertionInfo captures more info (for test cases and sections) 2012-11-04 21:09:22 +00:00
Phil Nash
a4e088c999 Removed __FUNCTION__ from SourceLineInfo 2012-11-02 08:29:03 +00:00
Phil Nash
e04e74f896 More AssertionResult refactoring 2012-10-24 21:59:47 +01:00
Phil Nash
4c97fc5619 WIldcards at both ends 2012-08-24 08:23:50 +01:00