Commit Graph

798 Commits

Author SHA1 Message Date
mat tso
a47b8dee74 Add support toString for containers
Standard container types were printed as `"{?}"`
(default `toString` implementation for unsupported class).
This was contradictory with the documentation:
> "Most [...] std types are supported out of the box"
when in fact only `string`, `vector` and `tupple` were supported.

 - Renamed the `toStringVector.cpp` test file to `toStringContainers.cpp`

 - Types are consider containers if they contain `value_type` and
   `const_iterator` members and have `begin` and `end` support
   (members or ADL findable) returning a `const_iterator`.
   `const_iterator::operator*` must also return a `const value_type &`

 - Beware that a trying to printing a type fulfilling those requirements
   but returning invalid iterators will results in undefined behaviour. In
   such case specialize the Catch::Detail::IsContainer trait to contain
   `static const bool value = false` to revert to the default behaviour
   (printing `"{?}"`).

Test pretty printing of `std::list`, `std::deque`, `std::forward_list`,
`std::array` in Catch assertion macro. More complex structure like
`std::queue` or `std::multi_map` should also be tested.

Signed-off-by: mat tso <mat-tso@topmail.ie>
2016-10-14 04:11:40 +02:00
mat tso
b0c88a3d96 Fix indentation of rangeToString in tostring.h 2016-10-11 04:33:23 +02:00
mat tso
c3d80cf5eb Publish toString support for pairs
Catch::toString support for pairs was implemented and tested
but not accessible from the include folder (thus in releases).
2016-10-11 03:10:41 +02:00
Phil Nash
40f6068d52 Build 1.5.7 2016-09-27 10:46:22 +01:00
Phil Nash
21cbfc107e --list-test-names quotes test names that start with #
- completes #717
2016-09-27 10:43:03 +01:00
Phil Nash
b1eeec7c69 -f supports quoted test names (test name surrounded with " characters).
This is the first part to resolving #717
2016-09-27 10:27:28 +01:00
Phil Nash
c23b374f3d Added braces to emphasise the return logic 2016-09-27 09:58:12 +01:00
nabijaczleweli
8c459dd207
Fix misindent
Closes #679
2016-09-27 00:35:26 +02:00
Phil Nash
c47c1797d2 Merge pull request #701 from razeh/master
Fixes for XML encoding.
2016-09-22 17:44:14 +01:00
Igor Akhmetov
02c7e41c7c Do not trim test case names in the XML reporter.
SCENARIO does not add leading spaces to the test name (only BDD-style section
names are modified), so the trimming is not necessary. But if the name is
trimmed, it makes it harder to correlate the output of XML reporter with tests
that have leading spaces in their name: e.g. these tests will have the same name
attribute:

TEST_CASE("Test") {}
TEST_CASE(" Test") {}
2016-08-30 11:15:19 +01:00
Robert A Zeh
5095619955 Fixes for XML encoding.
This commit fixes the following scenario:
  * You have a test that compares strings with embedded control
  characters.
  * The test fails.
  * You are using JUnit tests within TeamCity.

Before this commit, the JUnit report watcher fails on parsing the XML
for two reasons: the control characters are missing a semicolon at the
end, and the XML document doesn't specify that it is XML 1.1.

XML 1.0 --- what we get if we don't specify an XML version --- doesn't support embedding control characters --- see
http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml
for all of the gory details.

This is based on PR #588 by @mrpi
2016-08-24 09:38:24 -05:00
Phil Nash
35f510545d v1.5.6 2016-06-09 19:21:09 +01:00
Phil Nash
742457cbcf Use Clara v0.0.2.4 (updated) - fix for string lengths 2016-06-09 19:19:55 +01:00
Phil Nash
1aa6c91e64 Fixed RNG issue with pre C++14 compilers 2016-06-09 19:07:05 +01:00
Phil Nash
ac220289a6 v1.5.5:
Deal with auto_ptr and random_shuffle hard deprecations in C++14
2016-06-09 08:19:23 +01:00
Phil Nash
be3570ef22 Use std::shuffle instead of (deprecated) std::random_shuffle if C++14 detected 2016-06-09 08:15:57 +01:00
Phil Nash
a74d760d74 Switched remaining std::auto_ptrs to use CATCH_AUTO_PTR 2016-06-08 19:14:54 +01:00
Phil Nash
f666f5f0ae v1.5.4 2016-05-12 19:18:04 +01:00
Phil Nash
7940d58a2f "test" expression using !! instead of static_cast to bool.
This addresses #657 while (hopefully) maintaining fix for #574
2016-05-12 19:17:55 +01:00
Phil Nash
ebf9f3bb9d v1.5.3 2016-05-10 19:09:59 +01:00
Phil Nash
b57e734eb4 Merge branch 'throw-on-duplicate-tests' of git://github.com/rcdailey/Catch into rcdailey-throw-on-duplicate-tests 2016-05-10 19:06:47 +01:00
Phil Nash
5c198d85e6 v1.5.2 2016-05-07 23:14:04 +01:00
Phil Nash
5a6b291878 Using Clara 0.0.2.4 - fixes issue with spaces in quoted arguments 2016-05-07 23:12:46 +01:00
Phil Nash
92b141ee53 v1.5.1 2016-04-28 08:13:00 +01:00
Phil Nash
4f1263d6b4 Removed use of dynamic_cast from test_case_tracker.
(Thanks to #631 and #648)
2016-04-28 08:11:12 +01:00
Phil Nash
3b19458fed Removed use of dynamic_cast for MultipleReporters
(Thanks to #630, #636 and #648)
2016-04-28 08:11:12 +01:00
Phil Nash
0fe303b6b7 v1.5.0 (due to new embedded Clara) 2016-04-23 13:25:51 +01:00
Phil Nash
1c47fe023a Updated embedded Clara to 0.0.2.3
- has all new, more robust, token parsing.
- eliminates issue with unreachable code
- allows use of forward slashes to introduce short args on Windows
2016-04-23 13:21:29 +01:00
Robert Dailey
86c0ea2999 [#608] Don't use exit() on duplicate test descriptions
Instead of `exit(1)`, it now throws `std::runtime_error` with the details
of the failure. This exception is handled in `run()` at a higher level where
the log is printed to cerr and the test gracefully exits.
2016-04-01 11:56:51 -05:00
Ian Copland
7075b7defb Added missing CATCH_OVERRIDE to CumulativeReporterBase::assertionEnded(). This fixes a warning when building in Xcode 7.2+ with default warning settings. 2016-03-29 17:03:09 +01:00
Phil Nash
c984fc3ecd v1.4.0
- use __COUNTER__ for unique IDS instead of __LINE__ (where possible)
+ bug fixes
2016-03-15 07:24:26 +00:00
Phil Nash
447f53e9e3 Fixed !shouldfail 2016-03-14 19:13:34 +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
02af70ed0b build v1.3.6 (include's David Grayson's fix for the gcc pragma) 2016-03-11 18:31:52 +00:00
David Grayson
97e335437e Fix CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS: GCC needs to be capitalized.
Fixes issue #600.
2016-03-04 19:24:10 -08:00
Phil Nash
ae5ee2cf63 v1.3.5 2016-02-29 08:17:18 +00:00
Phil Nash
458f37ed57 Merge branch 'explicit-bool-conversion' of git://github.com/seanmiddleditch/Catch into seanmiddleditch-explicit-bool-conversion 2016-02-29 08:05:46 +00:00
Phil Nash
91bfe68a75 Suppress parentheses warnings on clang and gcc
- should address #593, #528, #521, #496 (and possibly others)
2016-02-29 08:03:48 +00:00
Phil Nash
8ccb18daa9 Added --use-colour option to give finer control over colourisation.
--force-colour is still present but deprecated (will remove in v2)
2016-02-29 08:03:48 +00:00
Sean Middleditch
776247af81 Support explicit operator bool
Fix for issue 596
2016-02-25 00:34:09 -08:00
Phil Nash
3b4edd7a48 Build for v1.3.4 2016-02-10 19:24:48 +00:00
Phil Nash
880a2046d9 Use Clara v0.0.1.1 2016-02-10 19:21:09 +00:00
Phil Nash
ffad3a0a39 Fix as suggested in #574
Cast expression to bool to prevent custom && from defeating short-circuiting
2016-02-10 05:49:56 +00:00
Phil Nash
c7243562b0 v1.3.3 2016-01-22 07:59:06 +00:00
Phil Nash
b84e08ad6f Fix EndsWith Matcher (and refactored EndsWith and StartsWith in terms of endsWith and startsWith) (see Issue #573) 2016-01-22 07:59:06 +00:00
Phil Nash
aca16a0f99 Fixed CATCH_REGISTER_TEST_CASE too 2016-01-22 07:50:10 +00:00
Phil Nash
f294c98472 Fixed REGISTER_TEST_CASE for VS2013 (hopefully)
- see #549
2016-01-05 08:19:16 +00:00
Phil Nash
7424b23bfb v1.3.1 2015-12-28 15:07:32 +00:00
Phil Nash
dbd3a84d92 Fixed catch_with_main.hpp (no longer references deleted catch_runner.hpp) 2015-12-28 15:06:04 +00:00
Simon Warta
a5fba672e1 Add missing comma when in captured expression for matchers
Such that
CHECK_THAT( hex_encode(outbuf) Equals("B5D4045C") )
becomes
CHECK_THAT( hex_encode(outbuf), Equals("B5D4045C") )
2015-12-10 08:09:10 +00:00