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
Barry
200d3ad824
Support for parenthesizing types with commas.
2018-04-20 15:11:09 +02:00
Martin Hořeňovský
414dcae34a
Allow only 1 reporter at a time
2018-04-07 12:05:29 +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
Martin Hořeňovský
1ca8f43b01
Add PredicateMatcher that takes an arbitrary predicate functions
...
Also adds `Predicate` helper function to create `PredicateMatcher`.
Because of limitations in type inference it needs to be explicitly
typed, like so
`Predicate<std::string>([](std::string const& str) { ... })`.
It also takes an optional second argument for description of the
predicate.
It is possible to infer the argument with sufficient TMP, see
https://stackoverflow.com/questions/43560492/how-to-extract-lambdas-return-type-and-variadic-parameters-pack-back-from-gener/43561563#43561563
but I don't think that the magic is worth introducing ATM.
Closes #1236
2018-04-04 11:14:19 +02:00
Martin Hořeňovský
3b801c4fda
Modify XML encoder to hex-encode invalid UTF-8 sequences
...
There are still some holes, e.g. we leave surrogate pairs be
even though they are not a part of valid UTF-8, but this might
be for the better -- WTF-8 does support surrogate pairs inside
text.
Closes #1207
2018-03-27 16:49:14 +02:00
jsc
8b78087412
Fix bug in WithinAbs::match() and add tests for it
2018-03-21 13:47:12 +01:00
Martin Hořeňovský
f988b4eb35
Covered more translation possibilities
2018-02-15 19:58:49 +01:00
Martin Hořeňovský
c0267e5c20
Add test for overriding the fallback stringifier
2018-02-15 16:06:35 +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
Martin Hořeňovský
681f5daa13
Update approval tests
2018-02-08 15:00:56 +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
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
Phil Nash
8be1df243e
Added test for stringifying std::arrays
2018-01-04 10:52:55 +00:00
Phil Nash
32eb90b9bd
Fix stringifying of unknown enums
2018-01-04 10:21:52 +00:00
Phil Nash
e41e8e8384
Added tests for stringifying map and set
2018-01-04 10:03:08 +00:00
Martin Hořeňovský
495d2458e0
Add UnorderedEqualsMatcher for vectors
...
Closes #1093
2017-12-07 19:05:00 +01:00
Martin Hořeňovský
0c122c135d
Add constructor arg checking to WithinAbsMatcher
...
Also tests :-)
2017-12-06 15:42:03 +01:00
Phil Nash
7c5a21fb7d
Added clog test
2017-12-05 17:48:15 +00:00
Martin Hořeňovský
8c32d0b644
Add more weird chrono::duration stringification tests
2017-11-28 21:47:06 +01:00
Martin Hořeňovský
73a1623eaf
Re-enable 2 string tests
2017-11-25 18:38:18 +01:00
Phil Nash
8da845810d
Rebased due to whitespace changes
2017-11-17 15:46:57 +00:00
Martin Hořeňovský
9796846ad0
Workaround libstdc++-4.8 regex issue in approval tests
2017-11-13 18:19:40 +01:00
Phil Nash
74d3dfd4cc
All tests files have .tests.cpp suffix. Also moved tests out of TestMain.cpp and moved up a level
2017-11-13 16:03:27 +00:00
Martin Hořeňovský
55b71bebf1
Add tests for case insensitive string matching
2017-11-13 15:46:33 +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
Phil Nash
3537b7858f
Removed vestigal ComparatorT template arg to MatcherBase
2017-11-13 10:08:48 +00:00
Martin Hořeňovský
b74d4ca96d
Add compilation test for #1027
2017-11-13 10:07:06 +01:00
Martin Hořeňovský
030321e3e0
Add NAN test for Approx
2017-11-10 18:48:45 +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ý
22ac9d2184
Approx cleanup: More tests, INFINITY handling, etc
2017-11-01 07:30:11 +01:00
Martin Hořeňovský
11f716f28d
Make Approx::margin inclusive
...
Fixes #952 , related to #980
2017-10-31 14:49:00 +01:00
Phil Nash
05b1ca2884
Fixed expansion of _FALSE binary expression
...
- see #1051
2017-10-13 19:45:19 +01:00
Phil Nash
c2b7bd15c0
Changed rhs expression capture from universal ref to const ref.
...
- addresses #1027
2017-10-13 14:16:14 +01:00
Martin Hořeňovský
17cdf20968
Mark part of std::chrono stringification tests nonportable
2017-10-09 14:56:23 +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
6105282c4f
Removed function pointer comparison test from approvals as it has different serilaisation behaviour in MSVC
2017-09-07 15:04:30 +01:00
Martin Hořeňovský
aef2e4d9e7
Update baselines
2017-09-02 20:29:05 +02:00
Martin Hořeňovský
ab5d176195
Fix/disable failing approval tests
2017-09-02 10:51:19 +02:00
Martin Hořeňovský
4e4a13dfb4
Update approvals after removing deprecated matcher helpers
2017-08-31 11:50:34 +02:00
Martin Hořeňovský
61d2c375dd
Add evaluation specialization for T* and long
...
Fixes #1005
2017-08-30 12:11:41 +02:00
Phil Nash
b8f482b9aa
Added test comparing non-copyable values
2017-08-17 16:48:46 +01:00
Martin Hořeňovský
f06ed856d8
Cherry picked 4f21bb72ff
(Add tests for #961 ) from master
...
- had to redo the baselines
2017-08-15 12:43:27 +01:00
Phil Nash
3772f69f0f
Removed String and StringBuilder
2017-08-14 09:04:14 +01:00
Phil Nash
bb8c1fb17f
Rebased with string conversion tests
2017-08-14 08:43:33 +01:00
Phil Nash
df5c31bb19
Cleaned up the output a bit
...
- removed [!shouldfail] test from "green" path
- changed "spanner" to more descriptive text
2017-08-11 10:38:29 +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ý
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
27fd8f80bd
Integrated INTERNAL_CATCH_THROWS_STR_MATCHES with new AssertionHandler
2017-08-09 00:44:30 +01:00
Phil Nash
4421672fb8
Removed benchmark tests from approval tests (for now)
2017-08-05 11:26:20 +01:00
Phil Nash
f45d35c980
Added benchmark tests
2017-08-05 11:12:29 +01:00
Phil Nash
58d8bc6985
Removed Text tests (TextFlow has it's own test suite)
2017-07-20 23:09:50 +01:00
Phil Nash
d3c7d424fe
Removed "long text" test (not a limitation of TextFlow)
2017-07-20 23:04:34 +01:00
Martin Hořeňovský
74ab1cd94b
Update Baselines
2017-07-20 00:29:19 +02:00
Phil Nash
c874a99c6c
Enabled c++11 tests in approvals
2017-07-13 08:52:51 +01:00
Martin Hořeňovský
bc73189c52
Rebase baselines to take into account the removed test
2017-07-12 16:27:09 +02:00
Phil Nash
60f25c7ffd
Added string tests to approvals
2017-06-29 11:19:08 +01:00
Phil Nash
c41a45e79c
Rebased following Clara changes
2017-06-12 23:13:27 +01:00
Martin Hořeňovský
07ef028483
Update baselines
2017-06-06 15:07:57 +02:00
Martin Hořeňovský
ea48ae0f75
Add test for #914 (stringify truthy exprs in standard way)
2017-05-27 14:42:05 +02: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ý
e641485132
Updated approval tests
2017-04-29 17:54:10 +02:00
Phil Nash
51c143b2c6
Added test for assertion with comma
2017-04-26 16:12:48 +01:00
Phil Nash
61ac34045c
Enabled SFINAE stream test
2017-04-25 14:57:58 +01:00
Phil Nash
714d01c07c
approved tests that were correct the first time (previous approvals were erroneous)
2017-04-09 20:40:11 +01:00
Phil Nash
250f0ee7fb
Added approvals for “failed as expected” tests
2017-04-07 09:33:19 +01: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
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ý
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ý
bbeb192ec9
Updated baselines
2017-02-27 16:27:43 +01:00
Phil Nash
10dfca34ac
Added first vector matchers (Contains and Equals)
2017-02-21 16:05:04 +00:00
Phil Nash
4e6938d78e
Moved matchers tests into their own file
2017-02-21 14:19:09 +00:00
Phil Nash
5530303be7
Removed test for invoking String Matcher with NULL (this will no longer be supported)
2017-02-14 09:16:54 +00:00
Phil Nash
873ef276b6
XML Reporter closes tag and flushes stream at end of TestCase and Section tags.
...
This fixes an issue where XML reports on stdout are broken by printf statements
2017-02-13 15:56:25 +00:00
Phil Nash
d6b8ac5a4e
Added compilation tests to approvals
2017-02-10 11:53:29 +00:00
Martin Hořeňovský
9952dda524
REQUIRE_THROWS_AS is now reported with expected type as well
...
Also updated tests to reflect this change.
2017-02-09 12:51:43 +01:00
Martin Hořeňovský
7db4d8d90c
Added tests (single char pretty printing + op overload)
...
Tests for issue #809 -- Potentional operator overload ambiguity -- and
PR #646 -- Pretty print characters.
2017-02-07 13:32:48 +01:00
Phil Nash
197bf075c4
Rebased again - against the right executable this time :-s
2017-02-06 16:25:09 +00:00
Phil Nash
1f5ec9884c
Rebased approvals following previous reversal (d’oh!)
2017-02-06 16:23:34 +00:00
Phil Nash
88b760276d
Revert "XmlWriter reverts to XML 1.0."
...
This reverts commit a189387f49
.
2017-02-06 16:21:01 +00:00
Phil Nash
a189387f49
XmlWriter reverts to XML 1.0.
...
Character encodings that are not valid in XML 1.0 are instead written using C-style escapes
2017-02-06 16:00:05 +00:00
Phil Nash
7bcb42496d
Changed exception tests to allow for now throw-from-CHECK behaviour
2017-01-23 17:56:41 +00:00
Phil Nash
225e90d8ba
Don’t include tests that rely on varying two-phase-lookup behaviour in approval tests
2017-01-23 17:47:58 +00:00
Phil Nash
4a04682e49
Text formatting rework
...
Rewrote main wrapping loop. Now uses iterators instead of indices and intermediate strings.
Differentiates between chars to wrap before, after or instead of.
Doesn’t preserve trailing newlines.
Wraps or more characters.
Dropped support for using tab character as an indent setting control char.
Hopefully avoids all the undefined behaviour and other bugs of the previous implementation.
2017-01-23 12:28:40 +00:00
Phil Nash
0cde0e90a6
Added approvals for “Greater-than inequalities with different epsilons” test
2017-01-09 14:40:09 +00:00
Phil Nash
0f0dcd31eb
Excluded two more C++11 tests from Approval tests
2017-01-09 14:37:28 +00:00
Phil Nash
62cbde369e
Exclude test name from approval tests
2017-01-09 14:37:28 +00:00
Phil Nash
1ae84897d4
Marked tests that use C++11 features with [c++11] tag and exclude them from approval tests
2017-01-09 14:37:28 +00:00
Phil Nash
79acc0504b
Sort test ordering during Approval testing
2016-11-29 11:32:16 +00:00
Phil Nash
31861bbd46
rebased following recent changes
2016-09-27 10:28:11 +01:00
Phil Nash
447f53e9e3
Fixed !shouldfail
2016-03-14 19:13:34 +00:00
Phil Nash
f895e0d95f
Rebased approvals following colour changes
2016-02-29 08:13:27 +00:00
Phil Nash
5262e61e9d
Approvals for Matcher change (added comma)
2015-12-10 18:43:29 +00:00
Phil Nash
0e64973f55
Added support for manually registering test functions.
...
As discussed in #421
2015-11-20 16:58:16 +00:00
Phil Nash
a49f088032
exception translators considered even for types deriving from std::exception, now
...
- also added docs for exception translators
- updated approvals
2015-11-18 08:39:21 +00:00