Commit Graph

997 Commits

Author SHA1 Message Date
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
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ý
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ý
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ý
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
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
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
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