Commit Graph

1488 Commits

Author SHA1 Message Date
Martin Hořeňovský 05cd05743a Provide a public method to get StringRef's underlying pointer
This allows reducing the amount of friends needed for its interface
and some extra tricks later.

The bad part is that the pointer can become invalidated via
calls to other StringRef's public methods, but c'est la vie.
2018-02-28 22:49:00 +01:00
Martin Hořeňovský 950ccf4749 StringRef appends itself to std::string efficiently 2018-02-28 16:02:25 +01:00
Martin Hořeňovský cf4b7eead9 Document CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS macro
Also fix how it can be disabled.
2018-02-25 21:22:38 +01:00
Martin Hořeňovský 7b6e49d795 Simplify logic selecting between signal handling/SEH/nothing
It was a bit of a mess previously
2018-02-23 14:56:07 +01:00
Martin Hořeňovský 0c5df42c28 Fix how windows.h is included in our files.
To prevent bugs with stitching system headers inside Catch,
the proxy header is responsible for guarding against inclusion
on Linux, rather than the includers.

Might be related to #1197
2018-02-23 12:40:12 +01:00
Martin Hořeňovský 4e57661919 StringRef will not take ownership when writing itself to stream
This also fixes some tests that were previously failing unnoticed - WTF?
2018-02-17 20:41:50 +01:00
Martin Hořeňovský da783abee9 Move fallback conversion after enum-check 2018-02-15 16:06:35 +01:00
Phil Nash bb84f0788a Removed unnecessary use of ostringstream from catch_enforce.h 2018-02-15 13:59:02 +00: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
Martin Hořeňovský ef2e112561 Disable POSIX signals for Emscripten
Related to #1114
2018-02-10 20:42:08 +01:00
dvirtz ca8470fbad https://github.com/catchorg/Catch2/issues/1175 - don't list hidden tests by default 2018-02-09 19:55:40 +01:00
dvirtz 355b3f9952 Add option to warn when no tests ran
Closes #1158
2018-02-09 18:49:36 +01:00
Martin Hořeňovský 7cbd0b587a v2.1.2 2018-02-09 17:10:27 +01:00
Martin Hořeňovský 8f3fc15b73 Update version of Clara
Fixes #1165
2018-02-09 16:50:19 +01:00
Martin Hořeňovský 1b2fa601c6 Remove superfluous comment 2018-02-08 13:09:02 +01:00
Martin Hořeňovský ba6d33fb8c Enable -Wpedantic, fix unconditional use of C++14 extension 2018-02-05 10:04:59 +01:00
Zachary Michaels 4be81d3588 Remove unnecessary semicolons 2018-02-05 10:03:51 +01:00
Josh Lospinoso 5201e92564 Redirect std::uncaught_exception to Catch::uncaught_exception
This means that only one place needs to work with warnings from
the deprecation of `std::uncaught_exception()` in C++17.

Closes #1162.
2018-02-02 15:36:15 +01:00
philsquared 5713381d06 Fixes for cygwin 2018-02-01 16:14:20 +00:00
Martin Hořeňovský 1ab6be30a2 Add a BrightYellow colour, also use it for reconstructed exprs
Closes #979
2018-02-01 14:58:33 +00: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ý 44dbda9f01 Add CATCH_VERSION_* defines for external use
I wonder how much use they will actually see, but their cost is
fairly minor.

Closes #1131
2018-01-26 20:56:14 +01:00
Phil Nash ca2455e6e6 Fixed NoAssertions warning 2018-01-26 16:52:28 +00:00
Martin Hořeňovský 62dae592c3 v2.1.1 2018-01-26 16:06:07 +01:00
Martin Hořeňovský a1aefce6e4 Guard against CLR exceptions when translating exceptions
Partially fixes #1138, need to decide what to do about structured
exceptions.
2018-01-24 12:11:29 +01:00
Phil Nash 31e6499e64 Embed Clara v1.1.1 2018-01-22 15:08:28 +00:00
Martin Hořeňovský 8d854c689b Provide useful and unambigous stringification for static arrays 2018-01-14 18:06:43 +01:00
Martin Hořeňovský de36b2ada6 Fix compilation for types where relops don't return bool
Closes #1147
2018-01-12 15:49:56 +01:00
Martin Hořeňovský 4575594bbf Comment why the return code is clamped 2018-01-12 11:49:48 +01:00
Martin Hořeňovský cd76f5730c v2.1.0 2018-01-10 13:53:04 +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ý f466d9a1ed Fix a7a9ee5 2017-12-09 20:49:06 +01:00
Martin Hořeňovský a7a9ee5552 Manual cherry-pick from #1111
This hsould merge still-valid piece of #1111 into master.
2017-12-09 20:17:47 +01:00
Phil Nash 347be87126 Removed debug code accidentally left in previous commit 2017-12-08 16:30:16 +00:00
Phil Nash 4da655c1b0 Increased int size for timers to avoid truncations 2017-12-08 15:59:00 +00:00
Martin Hořeňovský c4d1aa9033 Fix std::uncaught_exception deprecation warning in ~ScopedMessage
Closes #1124
2017-12-07 19:10:28 +01:00
Martin Hořeňovský 495d2458e0 Add UnorderedEqualsMatcher for vectors
Closes #1093
2017-12-07 19:05:00 +01:00
Phil Nash 3035120dc7 Some bits of tidy up 2017-12-07 00:02:32 +00:00
Martin Hořeňovský 0c122c135d Add constructor arg checking to WithinAbsMatcher
Also tests :-)
2017-12-06 15:42:03 +01:00
Phil Nash d19b7292b3 xml reporter reports WARN message when not used with -s 2017-12-06 14:30:17 +00:00
Phil Nash 5e063616df Moved runner helpers into Catch namespace
not sure they weren't there to start with
2017-12-05 23:26:21 +00:00
Phil Nash aa9d635014 Refactored StreamRedirect classes 2017-12-05 23:19:28 +00:00
Phil Nash 533cdc6bc1 Revirtualised IResultCapture methods
Didn't really impact runtime anyway, but will need to use interface for threading support.
2017-12-05 16:23:10 +00:00
Phil Nash dfa817ae73 Just track whether last assertion passed directly, rather than deduce it from counts 2017-12-02 18:44:23 +00:00
Phil Nash 57c346a46d Removed assertionRun() and rolled its logic into assertionPassed() and assertionEnded() 2017-12-02 18:44:23 +00:00
Phil Nash b76e80ed3d Small clean-ups 2017-11-30 17:54:44 +03:00
Martin Hořeňovský a3632facf3 Fix teamcity reporter compilation with single header 2017-11-30 13:48:24 +01:00
Phil Nash 7d0db6b8e9 Moved -Wparentheses suppression before the push for GCC
Because of bugs in GCC 4 & 5 that prevent _Pragma from working :-(
2017-11-29 20:19:50 +03:00
Phil Nash 8a7493cd88 Globally suppress Wunused-variable again, for now 2017-11-29 20:01:00 +03:00
Phil Nash b5a5d9a6f8 Stop leaking some warning suppressions to user code 2017-11-29 19:14:33 +03:00
Phil Nash e3941a9ad2 De-virtualised isBinaryExpression() and getResult() on ITransientExpression 2017-11-27 22:49:26 +03:00
Phil Nash da86ddc620 Fixed accidental const & formating 2017-11-27 22:28:45 +03:00
Phil Nash 4b614ee1d1 Moved all AssertionHandler logic into RunContext and de-virtualised interface
This makes the assertion handling much less "chatty". AssertionHandler is now just a thin shim over RunContext
2017-11-27 22:23:15 +03:00
Phil Nash 5461242ffe Renamed last usge specific handle method (and made the low level ones private) 2017-11-27 22:23:15 +03:00
Phil Nash db44964e27 Refactored most handle() calls to more specific/ descriptive calls 2017-11-26 21:28:43 +00:00
Phil Nash 2800adba25 Qualified handleExceptionMatchExpr in Catch::
(was picking it up by ADL before - no need to rely on that!)
2017-11-26 21:28:43 +00:00
Phil Nash c411c131cb Move crtdbg.h include outside namespace 2017-11-24 10:36:54 +00:00
Phil Nash 091595780e Clean-up re-usable string streams 2017-11-24 08:46:17 +00:00
Phil Nash f417995afc Cache IResultCapture in AssertionHandler to avoid repeated lookups 2017-11-23 19:21:09 +00:00
Phil Nash 9329d97a43 Always debug-break non-inline 2017-11-23 19:14:26 +00:00
Phil Nash 8141a7836f Inline shouldDebugBreak() 2017-11-23 16:58:43 +00:00
Phil Nash 5323202652 Bake exception guard into assertion handler flow 2017-11-23 16:52:46 +00:00
Martin Hořeňovský 401ad7a189 Remove isTrue, alwaysTrue, alwaysFalse
isTrue and alwaysFalse were replaced by (void)0, 0 inspired by doctest
alwaysTrue was replaced by warning suppression
2017-11-22 16:03:45 +01:00
Martin Hořeňovský 87c125ecb8 Enable Werror for dev builds 2017-11-21 18:55:28 +01:00
Phil Nash 3b965aa501 (re)Inlined isTrue() 2017-11-21 13:12:22 +00:00
Phil Nash e54dcdac8b Added space in StringRef literal operator 2017-11-21 12:09:04 +00:00
Phil Nash e4a898eaaa Removed templated StringRef ctor and added StringRef literal 2017-11-21 11:08:39 +00:00
Martin Hořeňovský a8a1c379c0 Introduce a way to intentionally expose interface for use in tests
Fixes #1076
2017-11-21 11:10:07 +01:00
Phil Nash e08a4ed99e Added missing <cstring> include to stringref.cpp 2017-11-21 09:26:56 +00:00
Phil Nash fcba30569c Refactored to resetAssertionInfo() 2017-11-20 16:33:06 +00:00
Phil Nash 4353614df7 Added StringRef constructor that captures string literal size at compile time 2017-11-20 16:33:05 +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
Neal Coombes f18366150e performance improvement - getCurrentContext
inlined getCurrentContext and getMutableContext
Further work on #1086.
Brings test from 0m37.913 to 0m25.584s
Catch2 is now faster than Catch 1.x!!
2017-11-17 14:55:30 -06:00
Neal Coombes fe725648a7 performance improvement - StringRef::operator=
inlined and reduced data copy in half.
Further work on #1086.
Brings test from 0m44.942s to 0m37.913.
2017-11-17 14:15:26 -06:00
Phil Nash b0c379f621 Inlined StringRef ctors/ dtor and size() and empty() 2017-11-17 18:38:54 +00:00
Neal Coombes b9339333df Performance improvement
Begin to address #1086
Brings test from 2m51.072s to 1m15.661s
2017-11-15 14:43:43 -06:00
Neal Coombes 61e29b5630 Fix AssertionPrinter name conflict in console and compact reporters 2017-11-15 21:26:31 +01:00
Martin Hořeňovský 9796a77a37 Initial prototype of PCH support
Related to #1061
2017-11-14 21:41:36 +01:00
Martin Hořeňovský 98d4c49d1c Provide ConsoleReporter declaration with EXTERNAL_INTERFACES
Related to #991
2017-11-14 20:42:58 +01:00
Martin Hořeňovský a096e4b3f2 Provide XmlReporter declaration with EXTERNAL_INTERFACES
Related to #991
2017-11-14 17:56:27 +01:00
Martin Hořeňovský 4b3730de8a Provide JunitReporter declaration with EXTERNAL_INTERFACES
Related to #991
2017-11-14 17:15:13 +01:00
Martin Hořeňovský 6acdacfde0 Provide CompactReporter declaration with EXTERNAL_INTERFACES
Related to #991
2017-11-14 16:13:35 +01:00
Martin Hořeňovský b0857e846f Provide a regex matcher against std::string
Related to #1040
2017-11-13 15:35:31 +01:00
Martin Hořeňovský a06b6dc3ea Remove pointless StringRef -> std::string conversions 2017-11-13 13:08:59 +01:00
Martin Hořeňovský 0adb04807a Change how non-nullness is enforce in StringRef constructor 2017-11-13 13:04:45 +01:00
Martin Hořeňovský f80f28e09a Fix pointless type mismatch between StringRef and std::string 2017-11-13 12:49:13 +01:00
Martin Hořeňovský 484eee973c Move StringRef's impl details to anonymous namespace 2017-11-13 12:41:04 +01:00
Martin Hořeňovský d09fe4459d Stop recounting constant string's length on each passed assertion 2017-11-13 12:27:02 +01:00
Martin Hořeňovský e484236825 Don't invoke UB when nullptr is passed to StringRef constructor 2017-11-13 12:09:19 +01:00
Martin Hořeňovský e7c23b73da Don't call strlen in StringRef when the length was already passed 2017-11-13 12:03:45 +01:00
Phil Nash 3537b7858f Removed vestigal ComparatorT template arg to MatcherBase 2017-11-13 10:08:48 +00:00
Martin Hořeňovský 8dbaac61ff Final set of fixes for floating matchers approvals 2017-11-12 11:49:36 +01:00
Martin Hořeňovský a0dbc62955 Fix OS X compilation error 2017-11-10 19:56:39 +01:00
Martin Hořeňovský 5f961af70e Remove leftover commented out lines 2017-11-10 18:37:58 +01:00
Martin Hořeňovský 0b1f1b1003 Add ULP and margin matcher
Closes #1074
2017-11-10 18:33:00 +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