mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-14 01:15:39 +02:00
Compare commits
84 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c6990cdf91 | ||
![]() |
da8786b8fd | ||
![]() |
5577322062 | ||
![]() |
1b03c5ab6a | ||
![]() |
7dd3c19027 | ||
![]() |
29d26d3179 | ||
![]() |
ca764ec8d9 | ||
![]() |
250f0ee7fb | ||
![]() |
09e4830199 | ||
![]() |
8f85d08e9f | ||
![]() |
3ae076ce8d | ||
![]() |
94425ad59b | ||
![]() |
0354d50278 | ||
![]() |
cdd83c2e15 | ||
![]() |
9a07dde16d | ||
![]() |
6e091d3991 | ||
![]() |
95d85fb186 | ||
![]() |
3a3f152979 | ||
![]() |
4fe2432e05 | ||
![]() |
c3a41e26a7 | ||
![]() |
4838039b65 | ||
![]() |
2a221b8fcd | ||
![]() |
79ce6930a2 | ||
![]() |
d762a7ca6c | ||
![]() |
f23b6b8b85 | ||
![]() |
4597b43912 | ||
![]() |
f64d914bff | ||
![]() |
d07999ddff | ||
![]() |
e04dc5105b | ||
![]() |
cffb031ce1 | ||
![]() |
f3ec843ba6 | ||
![]() |
55ed17f97b | ||
![]() |
6a502cc2f5 | ||
![]() |
6a009fabcb | ||
![]() |
7a8a0205b4 | ||
![]() |
4dc06bdb70 | ||
![]() |
08b597b3e2 | ||
![]() |
46d166406d | ||
![]() |
4ec8d53e91 | ||
![]() |
e7984e3711 | ||
![]() |
90d89377ea | ||
![]() |
0692317bc5 | ||
![]() |
95fc8d62a2 | ||
![]() |
0c015aa887 | ||
![]() |
f69f821853 | ||
![]() |
485dbdc0e7 | ||
![]() |
0afd52b98d | ||
![]() |
38b05f1400 | ||
![]() |
db9866677e | ||
![]() |
4101ff314a | ||
![]() |
68da5a6d19 | ||
![]() |
e4a25ad5ff | ||
![]() |
5d6c744d38 | ||
![]() |
5dd0639520 | ||
![]() |
a2515755c3 | ||
![]() |
807941eb31 | ||
![]() |
a2e20b07f8 | ||
![]() |
ace70407a2 | ||
![]() |
613e1466f9 | ||
![]() |
e95bf48445 | ||
![]() |
932a405e18 | ||
![]() |
9a037204fa | ||
![]() |
374c050a42 | ||
![]() |
8b8e3ee117 | ||
![]() |
af1ed708e4 | ||
![]() |
041498b221 | ||
![]() |
d5a5883a10 | ||
![]() |
6fea473414 | ||
![]() |
68e7fdce20 | ||
![]() |
b4c9bf5802 | ||
![]() |
e952fa8946 | ||
![]() |
84a178f0b0 | ||
![]() |
f9db24a824 | ||
![]() |
9bee606dd6 | ||
![]() |
be4f6ab8e1 | ||
![]() |
fd6c7aee6d | ||
![]() |
cd6de9cd34 | ||
![]() |
40f6a5b8a4 | ||
![]() |
95b0eb2b6c | ||
![]() |
0b28d3daf2 | ||
![]() |
8435dcbb61 | ||
![]() |
99347df70e | ||
![]() |
658b5f63ef | ||
![]() |
da023b2f9a |
@@ -135,6 +135,7 @@ set(INTERNAL_HEADERS
|
|||||||
${HEADER_DIR}/internal/catch_debugger.h
|
${HEADER_DIR}/internal/catch_debugger.h
|
||||||
${HEADER_DIR}/internal/catch_debugger.hpp
|
${HEADER_DIR}/internal/catch_debugger.hpp
|
||||||
${HEADER_DIR}/internal/catch_default_main.hpp
|
${HEADER_DIR}/internal/catch_default_main.hpp
|
||||||
|
${HEADER_DIR}/internal/catch_errno_guard.hpp
|
||||||
${HEADER_DIR}/internal/catch_evaluate.hpp
|
${HEADER_DIR}/internal/catch_evaluate.hpp
|
||||||
${HEADER_DIR}/internal/catch_exception_translator_registry.hpp
|
${HEADER_DIR}/internal/catch_exception_translator_registry.hpp
|
||||||
${HEADER_DIR}/internal/catch_expression_lhs.hpp
|
${HEADER_DIR}/internal/catch_expression_lhs.hpp
|
||||||
@@ -253,7 +254,7 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )
|
|||||||
target_compile_options( Benchmark PRIVATE -Wall -Wextra )
|
target_compile_options( Benchmark PRIVATE -Wall -Wextra )
|
||||||
endif()
|
endif()
|
||||||
if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
|
||||||
target_compile_options( SelfTest PRIVATE /W4 )
|
target_compile_options( SelfTest PRIVATE /W4 /w44265 /WX )
|
||||||
target_compile_options( Benchmark PRIVATE /W4 )
|
target_compile_options( Benchmark PRIVATE /W4 )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -268,4 +269,4 @@ set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test c
|
|||||||
add_test(NAME ListTags COMMAND SelfTest --list-tags)
|
add_test(NAME ListTags COMMAND SelfTest --list-tags)
|
||||||
set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags")
|
set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags")
|
||||||
|
|
||||||
install(DIRECTORY "single_include/" DESTINATION "include/catch/")
|
install(DIRECTORY "single_include/" DESTINATION "include/catch")
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||

|

|
||||||
|
|
||||||
*v1.8.1*
|
[](https://github.com/philsquared/catch/releases)
|
||||||
|
[](https://travis-ci.org/philsquared/Catch)
|
||||||
|
[](https://ci.appveyor.com/project/philsquared/catch/branch/master)
|
||||||
|
|
||||||
Build status (on Travis CI) [](https://travis-ci.org/philsquared/Catch)
|
<a href="https://github.com/philsquared/Catch/releases/download/v1.9.1/catch.hpp">The latest, single header, version can be downloaded directly using this link</a>
|
||||||
|
|
||||||
<a href="https://github.com/philsquared/Catch/releases/download/v1.8.1/catch.hpp">The latest, single header, version can be downloaded directly using this link</a>
|
|
||||||
|
|
||||||
## What's the Catch?
|
## What's the Catch?
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@ branches:
|
|||||||
os:
|
os:
|
||||||
- Visual Studio 2013
|
- Visual Studio 2013
|
||||||
- Visual Studio 2015
|
- Visual Studio 2015
|
||||||
|
- Visual Studio 2017
|
||||||
|
|
||||||
init:
|
init:
|
||||||
- git config --global core.autocrlf input
|
- git config --global core.autocrlf input
|
||||||
|
BIN
catch-hand-icon.png
Normal file
BIN
catch-hand-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
BIN
catch-icon-tiny.png
Normal file
BIN
catch-icon-tiny.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 19 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.7 KiB |
@@ -1,22 +1,29 @@
|
|||||||
These are the currently documented areas of the framework. There is more to come.
|
To get the most out of Catch, start with the [tutorial](tutorial.md).
|
||||||
|
Once you're up and running consider the following reference material.
|
||||||
Before looking at this material be sure to read the [tutorial](tutorial.md)
|
|
||||||
|
|
||||||
|
Writing tests:
|
||||||
* [Assertion macros](assertions.md)
|
* [Assertion macros](assertions.md)
|
||||||
* [Matchers](matchers.md)
|
* [Matchers](matchers.md)
|
||||||
* [Logging macros](logging.md)
|
* [Logging macros](logging.md)
|
||||||
* [Test cases and sections](test-cases-and-sections.md)
|
* [Test cases and sections](test-cases-and-sections.md)
|
||||||
* [Test fixtures](test-fixtures.md)
|
* [Test fixtures](test-fixtures.md)
|
||||||
|
* [Reporters](reporters.md)
|
||||||
|
* [Event Listeners](event-listeners.md)
|
||||||
|
|
||||||
|
Fine tuning:
|
||||||
|
* [Supplying your own main()](own-main.md)
|
||||||
|
* [Compile-time configuration](configuration.md)
|
||||||
|
* [String Conversions](tostring.md)
|
||||||
|
|
||||||
|
Running:
|
||||||
* [Command line](command-line.md)
|
* [Command line](command-line.md)
|
||||||
* [Build systems](build-systems.md)
|
* [Build systems](build-systems.md)
|
||||||
* [Supplying your own main()](own-main.md)
|
|
||||||
* [Configuration](configuration.md)
|
FAQ:
|
||||||
* [String Conversions](tostring.md)
|
|
||||||
* [Why are my tests slow to compile?](slow-compiles.md)
|
* [Why are my tests slow to compile?](slow-compiles.md)
|
||||||
* [Known limitations](limitations.md)
|
* [Known limitations](limitations.md)
|
||||||
|
|
||||||
Other
|
Other:
|
||||||
|
|
||||||
* [Why Catch?](why-catch.md)
|
* [Why Catch?](why-catch.md)
|
||||||
* [Open Source Projects using Catch](opensource-users.md)
|
* [Open Source Projects using Catch](opensource-users.md)
|
||||||
* [Contributing](contributing.md)
|
* [Contributing](contributing.md)
|
||||||
|
@@ -95,7 +95,7 @@ Expects that an exception (of any type) is be thrown during evaluation of the ex
|
|||||||
* **REQUIRE_THROWS_AS(** _expression_, _exception type_ **)** and
|
* **REQUIRE_THROWS_AS(** _expression_, _exception type_ **)** and
|
||||||
* **CHECK_THROWS_AS(** _expression_, _exception type_ **)**
|
* **CHECK_THROWS_AS(** _expression_, _exception type_ **)**
|
||||||
|
|
||||||
Expects that an exception of the _specified type_ is thrown during evaluation of the expression.
|
Expects that an exception of the _specified type_ is thrown during evaluation of the expression. Note that the _exception type_ is used verbatim and you should include (const) reference.
|
||||||
|
|
||||||
* **REQUIRE_THROWS_WITH(** _expression_, _string or string matcher_ **)** and
|
* **REQUIRE_THROWS_WITH(** _expression_, _string or string matcher_ **)** and
|
||||||
* **CHECK_THROWS_WITH(** _expression_, _string or string matcher_ **)**
|
* **CHECK_THROWS_WITH(** _expression_, _string or string matcher_ **)**
|
||||||
|
@@ -1,12 +1,16 @@
|
|||||||
# Commercial users of Catch
|
# Commercial users of Catch
|
||||||
|
|
||||||
As well as [Open Source](opensource-users.md) users Catch is widely used within proprietary code bases too. Many companies like to keep this
|
As well as [Open Source](opensource-users.md) users Catch is widely used within proprietary code bases too.
|
||||||
information internal, and that's fine, but if you're more open it would be great if we could list the names of as
|
Many organisations like to keep this information internal, and that's fine,
|
||||||
many organisations as possible that use Catch somewhere in their codebase. Enterprise environments often tend to be
|
but if you're more open it would be great if we could list the names of as
|
||||||
far more conservative in their tool adoption - and being aware that other companies are using Catch can ease the
|
many organisations as possible that use Catch somewhere in their codebase.
|
||||||
path in.
|
Enterprise environments often tend to be far more conservative in their tool adoption -
|
||||||
|
and being aware that other companies are using Catch can ease the path in.
|
||||||
|
|
||||||
So if you are aware of Catch usage in your organisation, and are fairly confident there is no issue with sharing this
|
So if you are aware of Catch usage in your organisation, and are fairly confident there is no issue with sharing this
|
||||||
fact then please let us know - either directly, via a PR or [issue](https://github.com/philsquared/Catch/issues), or on the [forums](https://groups.google.com/forum/?fromgroups#!forum/catch-forum).
|
fact then please let us know - either directly, via a PR or
|
||||||
|
[issue](https://github.com/philsquared/Catch/issues), or on the [forums](https://groups.google.com/forum/?fromgroups#!forum/catch-forum).
|
||||||
|
|
||||||
- Bloomberg
|
- Bloomberg
|
||||||
|
- NASA
|
||||||
|
|
||||||
|
@@ -52,17 +52,18 @@ This can be useful on certain platforms that do not provide ```std::cout``` and
|
|||||||
|
|
||||||
# C++ conformance toggles
|
# C++ conformance toggles
|
||||||
|
|
||||||
CATCH_CONFIG_CPP11_NULLPTR // nullptr is supported?
|
CATCH_CONFIG_CPP11_NULLPTR // nullptr is supported?
|
||||||
CATCH_CONFIG_CPP11_NOEXCEPT // noexcept is supported?
|
CATCH_CONFIG_CPP11_NOEXCEPT // noexcept is supported?
|
||||||
CATCH_CONFIG_CPP11_GENERATED_METHODS // delete and default keywords for methods
|
CATCH_CONFIG_CPP11_GENERATED_METHODS // delete and default keywords for methods
|
||||||
CATCH_CONFIG_CPP11_IS_ENUM // std::is_enum is supported?
|
CATCH_CONFIG_CPP11_IS_ENUM // std::is_enum is supported?
|
||||||
CATCH_CONFIG_CPP11_TUPLE // std::tuple is supported
|
CATCH_CONFIG_CPP11_TUPLE // std::tuple is supported
|
||||||
CATCH_CONFIG_VARIADIC_MACROS // Usually pre-C++11 compiler extensions are sufficient
|
CATCH_CONFIG_VARIADIC_MACROS // Usually pre-C++11 compiler extensions are sufficient
|
||||||
CATCH_CONFIG_CPP11_LONG_LONG // generates overloads for the long long type
|
CATCH_CONFIG_CPP11_LONG_LONG // generates overloads for the long long type
|
||||||
CATCH_CONFIG_CPP11_OVERRIDE // CATCH_OVERRIDE expands to override (for virtual function implementations)
|
CATCH_CONFIG_CPP11_OVERRIDE // CATCH_OVERRIDE expands to override (for virtual function implementations)
|
||||||
CATCH_CONFIG_CPP11_UNIQUE_PTR // Use std::unique_ptr instead of std::auto_ptr
|
CATCH_CONFIG_CPP11_UNIQUE_PTR // Use std::unique_ptr instead of std::auto_ptr
|
||||||
CATCH_CONFIG_CPP11_SHUFFLE // Use std::shuffle instead of std::random_shuffle
|
CATCH_CONFIG_CPP11_SHUFFLE // Use std::shuffle instead of std::random_shuffle
|
||||||
CATCH_CONFIG_CPP11_TYPE_TRAITS // Use std::enable_if and <type_traits>
|
CATCH_CONFIG_CPP11_TYPE_TRAITS // Use std::enable_if and <type_traits>
|
||||||
|
CATCH_CONFIG_CPP11_STREAM_INSERTABLE_CHECK // Use C++11 expression SFINAE to check if class can be inserted to std::ostream
|
||||||
|
|
||||||
Catch has some basic compiler detection that will attempt to select the appropriate mix of these macros. However being incomplete - and often without access to the respective compilers - this detection tends to be conservative.
|
Catch has some basic compiler detection that will attempt to select the appropriate mix of these macros. However being incomplete - and often without access to the respective compilers - this detection tends to be conservative.
|
||||||
So overriding control is given to the user. If a compiler supports a feature (and Catch does not already detect it) then one or more of these may be defined to enable it (or suppress it, in some cases). If you do do this please raise an issue, specifying your compiler version (ideally with an idea of how to detect it) and stating that it has such support.
|
So overriding control is given to the user. If a compiler supports a feature (and Catch does not already detect it) then one or more of these may be defined to enable it (or suppress it, in some cases). If you do do this please raise an issue, specifying your compiler version (ideally with an idea of how to detect it) and stating that it has such support.
|
||||||
@@ -70,24 +71,51 @@ You may also suppress any of these features by using the `_NO_` form, e.g. `CATC
|
|||||||
|
|
||||||
All C++11 support can be disabled with `CATCH_CONFIG_NO_CPP11`
|
All C++11 support can be disabled with `CATCH_CONFIG_NO_CPP11`
|
||||||
|
|
||||||
|
## `CATCH_CONFIG_CPP11_STREAM_INSERTABLE_CHECK`
|
||||||
|
|
||||||
|
This flag is off by default, but allows you to resolve problems caused by types with private base class that are streamable, but the classes themselves are not. Without it, the following code will cause a compilation error:
|
||||||
|
```cpp
|
||||||
|
#define CATCH_CONFIG_MAIN
|
||||||
|
#include <catch.hpp>
|
||||||
|
struct A {};
|
||||||
|
std::ostream &operator<< (std::ostream &o, const A &v) { return o << 0; }
|
||||||
|
|
||||||
|
struct B : private A {
|
||||||
|
bool operator==(int){ return true;}
|
||||||
|
};
|
||||||
|
|
||||||
|
B f ();
|
||||||
|
std::ostream g ();
|
||||||
|
|
||||||
|
TEST_CASE ("Error in streamable check") {
|
||||||
|
B x;
|
||||||
|
REQUIRE (x == 4);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
# Other toggles
|
# Other toggles
|
||||||
|
|
||||||
CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases
|
CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases
|
||||||
CATCH_CONFIG_WINDOWS_SEH // Enable SEH handling on Windows
|
CATCH_CONFIG_WINDOWS_SEH // Enable SEH handling on Windows
|
||||||
CATCH_CONFIG_FAST_COMPILE // Sacrifices some (extremely minor) features for compilation speed
|
CATCH_CONFIG_FAST_COMPILE // Sacrifices some (rather minor) features for compilation speed
|
||||||
CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals
|
CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals
|
||||||
CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap
|
CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap
|
||||||
|
|
||||||
Currently Catch enables `CATCH_CONFIG_WINDOWS_SEH` only when compiled with MSVC, because some versions of MinGW do not have the necessary Win32 API support.
|
Currently Catch enables `CATCH_CONFIG_WINDOWS_SEH` only when compiled with MSVC, because some versions of MinGW do not have the necessary Win32 API support.
|
||||||
|
|
||||||
At this moment, `CATCH_CONFIG_FAST_COMPILE` changes only the behaviour of the `-b` (`--break`) flag, making it break into debugger in a stack frame *below* the actual test, unlike the default behaviour, where the break into debugger occurs in the same stack frame as the actual test. `CATCH_CONFIG_FAST_COMPILE` has to be either defined, or not defined, in all translation units that are linked into single test binary, or the behaviour of setting `-b` flag will be unpredictable.
|
|
||||||
|
|
||||||
`CATCH_CONFIG_POSIX_SIGNALS` is on by default, except when Catch is compiled under `Cygwin`, where it is disabled by default (but can be force-enabled by defining `CATCH_CONFIG_POSIX_SIGNALS`).
|
`CATCH_CONFIG_POSIX_SIGNALS` is on by default, except when Catch is compiled under `Cygwin`, where it is disabled by default (but can be force-enabled by defining `CATCH_CONFIG_POSIX_SIGNALS`).
|
||||||
|
|
||||||
`CATCH_CONFIG_WINDOWS_CRTDBG` is off by default. If enabled, Windows's CRT is used to check for memory leaks, and displays them after the tests finish running.
|
`CATCH_CONFIG_WINDOWS_CRTDBG` is off by default. If enabled, Windows's CRT is used to check for memory leaks, and displays them after the tests finish running.
|
||||||
|
|
||||||
Just as with the C++11 conformance toggles, these toggles can be disabled by using `_NO_` form of the toggle, e.g. `CATCH_CONFIG_NO_WINDOWS_SEH`.
|
Just as with the C++11 conformance toggles, these toggles can be disabled by using `_NO_` form of the toggle, e.g. `CATCH_CONFIG_NO_WINDOWS_SEH`.
|
||||||
|
|
||||||
|
## `CATCH_CONFIG_FAST_COMPILE`
|
||||||
|
Defining this flag speeds up compilation of test files by ~20%, by making 2 changes:
|
||||||
|
* The `-b` (`--break`) flag no longer makes Catch break into debugger in the same stack frame as the failed test, but rather in a stack frame *below*.
|
||||||
|
* The `REQUIRE` family of macros (`REQUIRE`, `REQUIRE_FALSE` and `REQUIRE_THAT`) no longer uses local try-catch block. This disables exception translation, but should not lead to false negatives.
|
||||||
|
|
||||||
|
`CATCH_CONFIG_FAST_COMPILE` has to be either defined, or not defined, in all translation units that are linked into single test binary, or the behaviour of setting `-b` flag and throwing unexpected exceptions will be unpredictable.
|
||||||
|
|
||||||
# Windows header clutter
|
# Windows header clutter
|
||||||
|
|
||||||
On Windows Catch includes `windows.h`. To minimize global namespace clutter in the implementation file, it defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including it. You can control this behaviour via two macros:
|
On Windows Catch includes `windows.h`. To minimize global namespace clutter in the implementation file, it defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including it. You can control this behaviour via two macros:
|
||||||
|
73
docs/event-listeners.md
Normal file
73
docs/event-listeners.md
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
# Event Listeners
|
||||||
|
|
||||||
|
A `Listener` is a class you can register with Catch that will then be passed events,
|
||||||
|
such as a test case starting or ending, as they happen during a test run.
|
||||||
|
`Listeners` are actually types of `Reporters`, with a few small differences:
|
||||||
|
|
||||||
|
1. Once registered in code they are automatically used - you don't need to specify them on the command line
|
||||||
|
2. They are called in addition to (just before) any reporters, and you can register multiple listeners.
|
||||||
|
3. They derive from `Catch::TestEventListenerBase`, which has default stubs for all the events,
|
||||||
|
so you are not forced to implement events you're not interested in.
|
||||||
|
4. You register a listener with `CATCH_REGISTER_LISTENER`
|
||||||
|
|
||||||
|
|
||||||
|
## Implementing a Listener
|
||||||
|
|
||||||
|
In your main source file (i.e. the one that has the `#define` for `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`),
|
||||||
|
simply derive a class from `Catch::TestEventListenerBase` and implement the methods you are interested in.
|
||||||
|
Then register it using `INTERNAL_CATCH_REGISTER_LISTENER`.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```c++
|
||||||
|
#define CATCH_CONFIG_MAIN
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
struct MyListener : Catch::TestEventListenerBase {
|
||||||
|
|
||||||
|
using TestEventListenerBase::TestEventListenerBase; // inherit constructor
|
||||||
|
|
||||||
|
virtual void testCaseStarting( Catch::TestCaseInfo const& testInfo ) override {
|
||||||
|
// Perform some setup before a test case is run
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) override {
|
||||||
|
// Tear-down after a test case is run
|
||||||
|
}
|
||||||
|
};
|
||||||
|
CATCH_REGISTER_LISTENER( MyListener )
|
||||||
|
```
|
||||||
|
|
||||||
|
_Note that you should not use any assertion macros within a Listener!_
|
||||||
|
|
||||||
|
## Events that can be hooked
|
||||||
|
|
||||||
|
The following are the methods that can be overriden in the Listener:
|
||||||
|
|
||||||
|
```c++
|
||||||
|
// The whole test run, starting and ending
|
||||||
|
virtual void testRunStarting( TestRunInfo const& testRunInfo );
|
||||||
|
virtual void testRunEnded( TestRunStats const& testRunStats );
|
||||||
|
|
||||||
|
// Test cases starting and ending
|
||||||
|
virtual void testCaseStarting( TestCaseInfo const& testInfo );
|
||||||
|
virtual void testCaseEnded( TestCaseStats const& testCaseStats );
|
||||||
|
|
||||||
|
// Sections starting and ending
|
||||||
|
virtual void sectionStarting( SectionInfo const& sectionInfo );
|
||||||
|
virtual void sectionEnded( SectionStats const& sectionStats );
|
||||||
|
|
||||||
|
// Assertions before/ after
|
||||||
|
virtual void assertionStarting( AssertionInfo const& assertionInfo );
|
||||||
|
virtual bool assertionEnded( AssertionStats const& assertionStats );
|
||||||
|
|
||||||
|
// A test is being skipped (because it is "hidden")
|
||||||
|
virtual void skipTest( TestCaseInfo const& testInfo );
|
||||||
|
```
|
||||||
|
|
||||||
|
More information about the events (e.g. name of the test case) is contained in the structs passed as arguments -
|
||||||
|
just look in the source code to see what fields are available.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[Home](Readme.md)
|
@@ -26,6 +26,10 @@ The message is always reported but does not fail the test.
|
|||||||
|
|
||||||
The message is reported and the test case fails.
|
The message is reported and the test case fails.
|
||||||
|
|
||||||
|
**FAIL_CHECK(** _message expression_ **)**
|
||||||
|
|
||||||
|
AS `FAIL`, but does not abort the test
|
||||||
|
|
||||||
## Quickly capture a variable value
|
## Quickly capture a variable value
|
||||||
|
|
||||||
**CAPTURE(** _expression_ **)**
|
**CAPTURE(** _expression_ **)**
|
||||||
|
@@ -34,9 +34,18 @@ A, single-header, JSON parsing library that takes advantage of what C++ has to o
|
|||||||
### [MNMLSTC Core](https://github.com/mnmlstc/core)
|
### [MNMLSTC Core](https://github.com/mnmlstc/core)
|
||||||
a small and easy to use C++11 library that adds a functionality set that will be available in C++14 and later, as well as some useful additions
|
a small and easy to use C++11 library that adds a functionality set that will be available in C++14 and later, as well as some useful additions
|
||||||
|
|
||||||
|
### [nanodbc](https://github.com/lexicalunit/nanodbc/)
|
||||||
|
A small C++ library wrapper for the native C ODBC API.
|
||||||
|
|
||||||
|
### [Nonius](https://github.com/libnonius/nonius)
|
||||||
|
A header-only framework for benchmarking small snippets of C++ code.
|
||||||
|
|
||||||
### [SOCI](https://github.com/SOCI/soci)
|
### [SOCI](https://github.com/SOCI/soci)
|
||||||
The C++ Database Access Library
|
The C++ Database Access Library
|
||||||
|
|
||||||
|
### [polymorphic_value](https://github.com/jbcoe/polymorphic_value)
|
||||||
|
A polymorphic value-type for C++
|
||||||
|
|
||||||
### [Ppconsul](https://github.com/oliora/ppconsul)
|
### [Ppconsul](https://github.com/oliora/ppconsul)
|
||||||
A C++ client library for Consul. Consul is a distributed tool for discovering and configuring services in your infrastructure
|
A C++ client library for Consul. Consul is a distributed tool for discovering and configuring services in your infrastructure
|
||||||
|
|
||||||
@@ -48,6 +57,9 @@ A thread safe header only mocking framework for C++14
|
|||||||
|
|
||||||
## Applications & Tools
|
## Applications & Tools
|
||||||
|
|
||||||
|
### [ArangoDB](https://github.com/arangodb/arangodb)
|
||||||
|
ArangoDB is a native multi-model database with flexible data models for documents, graphs, and key-values.
|
||||||
|
|
||||||
### [MAME](https://github.com/mamedev/mame)
|
### [MAME](https://github.com/mamedev/mame)
|
||||||
MAME originally stood for Multiple Arcade Machine Emulator
|
MAME originally stood for Multiple Arcade Machine Emulator
|
||||||
|
|
||||||
|
@@ -1,3 +1,87 @@
|
|||||||
|
# 1.9.1
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
* Unexpected exceptions are no longer ignored by default (#885, #887)
|
||||||
|
|
||||||
|
|
||||||
|
# 1.9.0
|
||||||
|
|
||||||
|
|
||||||
|
### Improvements and minor changes
|
||||||
|
* Catch no longer attempts to ensure the exception type passed by user in `REQUIRE_THROWS_AS` is a constant reference.
|
||||||
|
* It was causing trouble when `REQUIRE_THROWS_AS` was used inside templated functions
|
||||||
|
* This actually reverts changes made in v1.7.2
|
||||||
|
* Catch's `Version` struct should no longer be double freed when multiple instances of Catch tests are loaded into single program (#858)
|
||||||
|
* It is now a static variable in an inline function instead of being an `extern`ed struct.
|
||||||
|
* Attempt to register invalid tag or tag alias now throws instead of calling `exit()`.
|
||||||
|
* Because this happen before entering main, it still aborts execution
|
||||||
|
* Further improvements to this are coming
|
||||||
|
* `CATCH_CONFIG_FAST_COMPILE` now speeds-up compilation of `REQUIRE*` assertions by further ~15%.
|
||||||
|
* The trade-off is disabling translation of unexpected exceptions into text.
|
||||||
|
* When Catch is compiled using C++11, `Approx` is now constructible with anything that can be explicitly converted to `double`.
|
||||||
|
* Captured messages are now printed on unexpected exceptions
|
||||||
|
|
||||||
|
### Fixes:
|
||||||
|
* Clang's `-Wexit-time-destructors` should be suppressed for Catch's internals
|
||||||
|
* GCC's `-Wparentheses` is now suppressed for all TU's that include `catch.hpp`.
|
||||||
|
* This is functionally a revert of changes made in 1.8.0, where we tried using `_Pragma` based suppression. This should have kept the suppression local to Catch's assertions, but bugs in GCC's handling of `_Pragma`s in C++ mode meant that it did not always work.
|
||||||
|
* You can now tell Catch to use C++11-based check when checking whether a type can be streamed to output.
|
||||||
|
* This fixes cases when an unstreamable type has streamable private base (#877)
|
||||||
|
* [Details can be found in documentation](configuration.md#catch_config_cpp11_stream_insertable_check)
|
||||||
|
|
||||||
|
|
||||||
|
### Other notes:
|
||||||
|
* We have added VS 2017 to our CI
|
||||||
|
* Work on Catch 2 should start soon
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 1.8.2
|
||||||
|
|
||||||
|
|
||||||
|
### Improvements and minor changes
|
||||||
|
* TAP reporter now behaves as if `-s` was always set
|
||||||
|
* This should be more consistent with the protocol desired behaviour.
|
||||||
|
* Compact reporter now obeys `-d yes` argument (#780)
|
||||||
|
* The format is "XXX.123 s: <section-name>" (3 decimal places are always present).
|
||||||
|
* Before it did not report the durations at all.
|
||||||
|
* XML reporter now behaves the same way as Console reporter in regards to `INFO`
|
||||||
|
* This means it reports `INFO` messages on success, if output on success (`-s`) is enabled.
|
||||||
|
* Previously it only reported `INFO` messages on failure.
|
||||||
|
* `CAPTURE(expr)` now stringifies `expr` in the same way assertion macros do (#639)
|
||||||
|
* Listeners are now finally [documented](event-listeners.md).
|
||||||
|
* Listeners provide a way to hook into events generated by running your tests, including start and end of run, every test case, every section and every assertion.
|
||||||
|
|
||||||
|
|
||||||
|
### Fixes:
|
||||||
|
* Catch no longer attempts to reconstruct expression that led to a fatal error (#810)
|
||||||
|
* This fixes possible signal/SEH loop when processing expressions, where the signal was triggered by expression decomposition.
|
||||||
|
* Fixed (C4265) missing virtual destructor warning in Matchers (#844)
|
||||||
|
* `std::string`s are now taken by `const&` everywhere (#842).
|
||||||
|
* Previously some places were taking them by-value.
|
||||||
|
* Catch should no longer change errno (#835).
|
||||||
|
* This was caused by libstdc++ bug that we now work around.
|
||||||
|
* Catch now provides `FAIL_CHECK( ... )` macro (#765).
|
||||||
|
* Same as `FAIL( ... )`, but does not abort the test.
|
||||||
|
* Functions like `fabs`, `tolower`, `memset`, `isalnum` are now used with `std::` qualification (#543).
|
||||||
|
* Clara no longer assumes first argument (binary name) is always present (#729)
|
||||||
|
* If it is missing, empty string is used as default.
|
||||||
|
* Clara no longer reads 1 character past argument string (#830)
|
||||||
|
* Regression in Objective-C bindings (Matchers) fixed (#854)
|
||||||
|
|
||||||
|
|
||||||
|
### Other notes:
|
||||||
|
* We have added VS 2013 and 2015 to our CI
|
||||||
|
* Catch Classic (1.x.x) now contains its own, forked, version of Clara (the argument parser).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 1.8.1
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
Cygwin issue with `gettimeofday` - `#define` was not early enough
|
||||||
|
|
||||||
# 1.8.0
|
# 1.8.0
|
||||||
|
|
||||||
### New features/ minor changes
|
### New features/ minor changes
|
||||||
@@ -11,14 +95,14 @@
|
|||||||
* Added opt-in leak detection under MSVC + Windows (#439)
|
* Added opt-in leak detection under MSVC + Windows (#439)
|
||||||
* Enable it by compiling Catch's main with `CATCH_CONFIG_WINDOWS_CRTDBG`
|
* Enable it by compiling Catch's main with `CATCH_CONFIG_WINDOWS_CRTDBG`
|
||||||
* Introduced new compile-time flag, `CATCH_CONFIG_FAST_COMPILE`, trading features for compilation speed.
|
* Introduced new compile-time flag, `CATCH_CONFIG_FAST_COMPILE`, trading features for compilation speed.
|
||||||
* Moves debug breaks out of tests and into implementation, speeding up compilation time
|
* Moves debug breaks out of tests and into implementation, speeding up test compilation time (~10% on linux).
|
||||||
* _More changes are coming_
|
* _More changes are coming_
|
||||||
* Added [TAP (Test Anything Protocol)](https://testanything.org/) and [Automake](https://www.gnu.org/software/automake/manual/html_node/Log-files-generation-and-test-results-recording.html#Log-files-generation-and-test-results-recording) reporters.
|
* Added [TAP (Test Anything Protocol)](https://testanything.org/) and [Automake](https://www.gnu.org/software/automake/manual/html_node/Log-files-generation-and-test-results-recording.html#Log-files-generation-and-test-results-recording) reporters.
|
||||||
* These are not present in the default single-include header and need to be downloaded from GitHub separately.
|
* These are not present in the default single-include header and need to be downloaded from GitHub separately.
|
||||||
* For details see [documentation about integrating with build systems](build-systems.md).
|
* For details see [documentation about integrating with build systems](build-systems.md).
|
||||||
* XML reporter now reports filename as part of the `Section` and `TestCase` tags.
|
* XML reporter now reports filename as part of the `Section` and `TestCase` tags.
|
||||||
* `Approx` now supports an optional margin of absolute error
|
* `Approx` now supports an optional margin of absolute error
|
||||||
* It has also received [new documentation]().
|
* It has also received [new documentation](assertions.md).
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
* Silenced C4312 ("conversion from int to 'ClassName *") warnings in the evaluate layer.
|
* Silenced C4312 ("conversion from int to 'ClassName *") warnings in the evaluate layer.
|
||||||
@@ -61,7 +145,7 @@ Other:
|
|||||||
### Fixes:
|
### Fixes:
|
||||||
* Fixed inconsistency in defining `NOMINMAX` and `WIN32_LEAN_AND_MEAN` inside `catch.hpp`.
|
* Fixed inconsistency in defining `NOMINMAX` and `WIN32_LEAN_AND_MEAN` inside `catch.hpp`.
|
||||||
* Fixed SEH-related compilation error under older MinGW compilers, by making Windows SEH handling opt-in for compilers other than MSVC.
|
* Fixed SEH-related compilation error under older MinGW compilers, by making Windows SEH handling opt-in for compilers other than MSVC.
|
||||||
* For specifics, look into the [documentation](docs/configuration.md).
|
* For specifics, look into the [documentation](configuration.md).
|
||||||
* Fixed compilation error under MinGW caused by improper compiler detection.
|
* Fixed compilation error under MinGW caused by improper compiler detection.
|
||||||
* Fixed XML reporter sometimes leaving an empty output file when a test ends with signal/structured exception.
|
* Fixed XML reporter sometimes leaving an empty output file when a test ends with signal/structured exception.
|
||||||
* Fixed XML reporter not reporting captured stdout/stderr.
|
* Fixed XML reporter not reporting captured stdout/stderr.
|
||||||
@@ -75,7 +159,7 @@ Other:
|
|||||||
* Microbenchmark focused on Catch's overhead went from ~3.4s to ~0.7s.
|
* Microbenchmark focused on Catch's overhead went from ~3.4s to ~0.7s.
|
||||||
* Real world test using [JSON for Modern C++](https://github.com/nlohmann/json)'s test suite went from ~6m 25s to ~4m 14s.
|
* Real world test using [JSON for Modern C++](https://github.com/nlohmann/json)'s test suite went from ~6m 25s to ~4m 14s.
|
||||||
* Catch can now run specific sections within test cases.
|
* Catch can now run specific sections within test cases.
|
||||||
* For now the support is only basic (no wildcards or tags), for details see the [documentation](docs/command-line.md).
|
* For now the support is only basic (no wildcards or tags), for details see the [documentation](command-line.md).
|
||||||
* Catch now supports SEH on Windows as well as signals on Linux.
|
* Catch now supports SEH on Windows as well as signals on Linux.
|
||||||
* After receiving a signal, Catch reports failing assertion and then passes the signal onto the previous handler.
|
* After receiving a signal, Catch reports failing assertion and then passes the signal onto the previous handler.
|
||||||
* Approx can be used to compare values against strong typedefs (available in C++11 mode only).
|
* Approx can be used to compare values against strong typedefs (available in C++11 mode only).
|
||||||
@@ -112,7 +196,7 @@ Other:
|
|||||||
* Approval tests can now be run on Windows
|
* Approval tests can now be run on Windows
|
||||||
* CMake will now warn if a file is present in the `include` folder but not is not enumerated as part of the project
|
* CMake will now warn if a file is present in the `include` folder but not is not enumerated as part of the project
|
||||||
* Catch now defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including `windows.h`
|
* Catch now defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including `windows.h`
|
||||||
* This can be disabled if needed, see [documentation](docs/configuration.md) for details.
|
* This can be disabled if needed, see [documentation](configuration.md) for details.
|
||||||
|
|
||||||
|
|
||||||
## 1.6.0
|
## 1.6.0
|
||||||
|
45
docs/reporters.md
Normal file
45
docs/reporters.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Reporters
|
||||||
|
|
||||||
|
Catch has a modular reporting system and comes bundled with a handful of useful reporters built in.
|
||||||
|
You can also write your own reporters.
|
||||||
|
|
||||||
|
## Using different reporters
|
||||||
|
|
||||||
|
The reporter to use can easily be controlled from the command line.
|
||||||
|
To specify a reporter use [`-r` or `--reporter`](command-line.md#choosing-a-reporter-to-use), followed by the name of the reporter, e.g.:
|
||||||
|
|
||||||
|
```
|
||||||
|
-r xml
|
||||||
|
```
|
||||||
|
|
||||||
|
If you don't specify a reporter then the console reporter is used by default.
|
||||||
|
There are four reporters built in to the single include:
|
||||||
|
|
||||||
|
* `console` writes as lines of text, formatted to a typical terminal width, with colours if a capable terminal is detected.
|
||||||
|
* `compact` similar to `console` but optimised for minimal output - each entry on one line
|
||||||
|
* `junit` writes xml that corresponds to Ant's [junitreport](http://help.catchsoftware.com/display/ET/JUnit+Format) target. Useful for build systems that understand Junit.
|
||||||
|
Because of the way the junit format is structured the run must complete before anything is written.
|
||||||
|
* `xml` writes an xml format tailored to Catch. Unlike `junit` this is a streaming format so results are delivered progressively.
|
||||||
|
|
||||||
|
There are a few additional reporters, for specific build systems, in the Catch repository (in `include\reporters`) which you can `#include` in your project if you would like to make use of them.
|
||||||
|
Do this in one source file - typically the same one you have `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`.
|
||||||
|
|
||||||
|
* `teamcity` writes the native, streaming, format that [TeamCity](https://www.jetbrains.com/teamcity/) understands.
|
||||||
|
Use this when building as part of a TeamCity build to see results as they happen.
|
||||||
|
* `tap` writes in the TAP ([Test Anything Protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol)) format.
|
||||||
|
* `automake` writes in a format that correspond to [automake .trs](https://www.gnu.org/software/automake/manual/html_node/Log-files-generation-and-test-results-recording.html) files
|
||||||
|
|
||||||
|
You see what reporters are available from the command line by running with `--list-reporters`.
|
||||||
|
|
||||||
|
By default all these reports are written to stdout, but can be redirected to a file with [`-o` or `--out`](command-line.md#sending-output-to-a-file)
|
||||||
|
|
||||||
|
## Writing your own reporter
|
||||||
|
|
||||||
|
You can write your own custom reporter and register it with Catch.
|
||||||
|
At time of writing the interface is subject to some changes so is not, yet, documented here.
|
||||||
|
If you are determined you shouldn't have too much trouble working it out from the existing implementations -
|
||||||
|
but do keep in mind upcoming changes (these will be minor, simplifying, changes such as not needing to forward calls to the base class).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[Home](Readme.md)
|
@@ -38,10 +38,10 @@ All tag names beginning with non-alphanumeric characters are reserved by Catch.
|
|||||||
|
|
||||||
* `[!throws]` - lets Catch know that this test is likely to throw an exception even if successful. This causes the test to be excluded when running with `-e` or `--nothrow`.
|
* `[!throws]` - lets Catch know that this test is likely to throw an exception even if successful. This causes the test to be excluded when running with `-e` or `--nothrow`.
|
||||||
|
|
||||||
* `[!shouldfail]` - reverse the failing logic of the test: if the test is successful if it fails, and vice-versa.
|
|
||||||
|
|
||||||
* `[!mayfail]` - doesn't fail the test if any given assertion fails (but still reports it). This can be useful to flag a work-in-progress, or a known issue that you don't want to immediately fix but still want to track in the your tests.
|
* `[!mayfail]` - doesn't fail the test if any given assertion fails (but still reports it). This can be useful to flag a work-in-progress, or a known issue that you don't want to immediately fix but still want to track in the your tests.
|
||||||
|
|
||||||
|
* `[!shouldfail]` - like `[!mayfail]` but *fails* the test if it *passes*. This can be useful if you want to be notified of accidental, or third-party, fixes.
|
||||||
|
|
||||||
* `[!nonportable]` - Indicates that behaviour may vary between platforms or compilers.
|
* `[!nonportable]` - Indicates that behaviour may vary between platforms or compilers.
|
||||||
|
|
||||||
* `[#<filename>]` - running with `-#` or `--filenames-as-tags` causes Catch to add the filename, prefixed with `#` (and with any extension stripped) as a tag. e.g. tests in testfile.cpp would all be tagged `[#testfile]`.
|
* `[#<filename>]` - running with `-#` or `--filenames-as-tags` causes Catch to add the filename, prefixed with `#` (and with any extension stripped) as a tag. e.g. tests in testfile.cpp would all be tagged `[#testfile]`.
|
||||||
|
@@ -91,33 +91,44 @@ LeakDetector leakDetector;
|
|||||||
// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
|
// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
|
||||||
#ifdef CATCH_CONFIG_PREFIX_ALL
|
#ifdef CATCH_CONFIG_PREFIX_ALL
|
||||||
|
|
||||||
#define CATCH_REQUIRE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::Normal, "CATCH_REQUIRE" )
|
#if defined(CATCH_CONFIG_FAST_COMPILE)
|
||||||
#define CATCH_REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, "CATCH_REQUIRE_FALSE" )
|
#define CATCH_REQUIRE( expr ) INTERNAL_CATCH_TEST_NO_TRY( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, expr )
|
||||||
|
#define CATCH_REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST_NO_TRY( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, expr )
|
||||||
|
#else
|
||||||
|
#define CATCH_REQUIRE( expr ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, expr )
|
||||||
|
#define CATCH_REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, expr )
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CATCH_REQUIRE_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::Normal, "", "CATCH_REQUIRE_THROWS" )
|
#define CATCH_REQUIRE_THROWS( expr ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, "", expr )
|
||||||
#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::Normal, "CATCH_REQUIRE_THROWS_AS" )
|
#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
|
||||||
#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::Normal, matcher, "CATCH_REQUIRE_THROWS_WITH" )
|
#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
|
||||||
#define CATCH_REQUIRE_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::Normal, "CATCH_REQUIRE_NOTHROW" )
|
#define CATCH_REQUIRE_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, expr )
|
||||||
|
|
||||||
#define CATCH_CHECK( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK" )
|
#define CATCH_CHECK( expr ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, expr )
|
||||||
#define CATCH_CHECK_FALSE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, "CATCH_CHECK_FALSE" )
|
#define CATCH_CHECK_FALSE( expr ) INTERNAL_CATCH_TEST( "CATCH_CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, expr )
|
||||||
#define CATCH_CHECKED_IF( expr ) INTERNAL_CATCH_IF( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECKED_IF" )
|
#define CATCH_CHECKED_IF( expr ) INTERNAL_CATCH_IF( "CATCH_CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, expr )
|
||||||
#define CATCH_CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECKED_ELSE" )
|
#define CATCH_CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( "CATCH_CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, expr )
|
||||||
#define CATCH_CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, "CATCH_CHECK_NOFAIL" )
|
#define CATCH_CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( "CATCH_CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, expr )
|
||||||
|
|
||||||
#define CATCH_CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::ContinueOnFailure, "", "CATCH_CHECK_THROWS" )
|
#define CATCH_CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, "", expr )
|
||||||
#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THROWS_AS" )
|
#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
|
||||||
#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::ContinueOnFailure, matcher, "CATCH_CHECK_THROWS_WITH" )
|
#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
||||||
#define CATCH_CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_NOTHROW" )
|
#define CATCH_CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, expr )
|
||||||
|
|
||||||
#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::ContinueOnFailure, "CATCH_CHECK_THAT" )
|
#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
|
||||||
#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::Normal, "CATCH_REQUIRE_THAT" )
|
|
||||||
|
|
||||||
#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( msg, "CATCH_INFO" )
|
#if defined(CATCH_CONFIG_FAST_COMPILE)
|
||||||
#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "CATCH_WARN", msg )
|
#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT_NO_TRY( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
|
||||||
#define CATCH_SCOPED_INFO( msg ) INTERNAL_CATCH_INFO( msg, "CATCH_INFO" )
|
#else
|
||||||
#define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CATCH_CAPTURE" )
|
#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
|
||||||
#define CATCH_SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CATCH_CAPTURE" )
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg )
|
||||||
|
#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )
|
||||||
|
#define CATCH_SCOPED_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg )
|
||||||
|
#define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CATCH_CAPTURE", #msg " := " << Catch::toString(msg) )
|
||||||
|
#define CATCH_SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CATCH_CAPTURE", #msg " := " << Catch::toString(msg) )
|
||||||
|
|
||||||
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
||||||
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
||||||
@@ -126,15 +137,17 @@ LeakDetector leakDetector;
|
|||||||
#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
|
#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
|
||||||
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
||||||
#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", __VA_ARGS__ )
|
#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", __VA_ARGS__ )
|
||||||
#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", __VA_ARGS__ )
|
#define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
|
#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
#else
|
#else
|
||||||
#define CATCH_TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
#define CATCH_TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
||||||
#define CATCH_TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
#define CATCH_TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
||||||
#define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
#define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
||||||
#define CATCH_REGISTER_TEST_CASE( function, name, description ) INTERNAL_CATCH_REGISTER_TESTCASE( function, name, description )
|
#define CATCH_REGISTER_TEST_CASE( function, name, description ) INTERNAL_CATCH_REGISTER_TESTCASE( function, name, description )
|
||||||
#define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
#define CATCH_SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
||||||
#define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "CATCH_FAIL", msg )
|
#define CATCH_FAIL( msg ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, msg )
|
||||||
#define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "CATCH_SUCCEED", msg )
|
#define CATCH_FAIL_CHECK( msg ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, msg )
|
||||||
|
#define CATCH_SUCCEED( msg ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, msg )
|
||||||
#endif
|
#endif
|
||||||
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" )
|
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" )
|
||||||
|
|
||||||
@@ -160,50 +173,64 @@ LeakDetector leakDetector;
|
|||||||
// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
|
// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define REQUIRE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::Normal, "REQUIRE" )
|
#if defined(CATCH_CONFIG_FAST_COMPILE)
|
||||||
#define REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, "REQUIRE_FALSE" )
|
#define REQUIRE( expr ) INTERNAL_CATCH_TEST_NO_TRY( "REQUIRE", Catch::ResultDisposition::Normal, expr )
|
||||||
|
#define REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST_NO_TRY( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, expr )
|
||||||
|
|
||||||
#define REQUIRE_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::Normal, "", "REQUIRE_THROWS" )
|
#else
|
||||||
#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::Normal, "REQUIRE_THROWS_AS" )
|
#define REQUIRE( expr ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, expr )
|
||||||
#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::Normal, matcher, "REQUIRE_THROWS_WITH" )
|
#define REQUIRE_FALSE( expr ) INTERNAL_CATCH_TEST( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, expr )
|
||||||
#define REQUIRE_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::Normal, "REQUIRE_NOTHROW" )
|
#endif
|
||||||
|
|
||||||
#define CHECK( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure, "CHECK" )
|
#define REQUIRE_THROWS( expr ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, "", expr )
|
||||||
#define CHECK_FALSE( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, "CHECK_FALSE" )
|
#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
|
||||||
#define CHECKED_IF( expr ) INTERNAL_CATCH_IF( expr, Catch::ResultDisposition::ContinueOnFailure, "CHECKED_IF" )
|
#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
|
||||||
#define CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( expr, Catch::ResultDisposition::ContinueOnFailure, "CHECKED_ELSE" )
|
#define REQUIRE_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, expr )
|
||||||
#define CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( expr, Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, "CHECK_NOFAIL" )
|
|
||||||
|
|
||||||
#define CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::ContinueOnFailure, "", "CHECK_THROWS" )
|
#define CHECK( expr ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, expr )
|
||||||
#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( expr, exceptionType, Catch::ResultDisposition::ContinueOnFailure, "CHECK_THROWS_AS" )
|
#define CHECK_FALSE( expr ) INTERNAL_CATCH_TEST( "CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, expr )
|
||||||
#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( expr, Catch::ResultDisposition::ContinueOnFailure, matcher, "CHECK_THROWS_WITH" )
|
#define CHECKED_IF( expr ) INTERNAL_CATCH_IF( "CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, expr )
|
||||||
#define CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( expr, Catch::ResultDisposition::ContinueOnFailure, "CHECK_NOTHROW" )
|
#define CHECKED_ELSE( expr ) INTERNAL_CATCH_ELSE( "CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, expr )
|
||||||
|
#define CHECK_NOFAIL( expr ) INTERNAL_CATCH_TEST( "CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, expr )
|
||||||
|
|
||||||
#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::ContinueOnFailure, "CHECK_THAT" )
|
#define CHECK_THROWS( expr ) INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, "", expr )
|
||||||
#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( arg, matcher, Catch::ResultDisposition::Normal, "REQUIRE_THAT" )
|
#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
|
||||||
|
#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
||||||
|
#define CHECK_NOTHROW( expr ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, expr )
|
||||||
|
|
||||||
#define INFO( msg ) INTERNAL_CATCH_INFO( msg, "INFO" )
|
#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
|
||||||
#define WARN( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, "WARN", msg )
|
|
||||||
#define SCOPED_INFO( msg ) INTERNAL_CATCH_INFO( msg, "INFO" )
|
#if defined(CATCH_CONFIG_FAST_COMPILE)
|
||||||
#define CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CAPTURE" )
|
#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT_NO_TRY( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
|
||||||
#define SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( #msg " := " << msg, "CAPTURE" )
|
#else
|
||||||
|
#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg )
|
||||||
|
#define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )
|
||||||
|
#define SCOPED_INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg )
|
||||||
|
#define CAPTURE( msg ) INTERNAL_CATCH_INFO( "CAPTURE", #msg " := " << Catch::toString(msg) )
|
||||||
|
#define SCOPED_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CAPTURE", #msg " := " << Catch::toString(msg) )
|
||||||
|
|
||||||
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
||||||
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
|
||||||
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
||||||
#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
||||||
#define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
|
#define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
|
||||||
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
||||||
#define FAIL( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", __VA_ARGS__ )
|
#define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
||||||
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", __VA_ARGS__ )
|
#define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
|
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
#else
|
#else
|
||||||
#define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
#define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
||||||
#define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
#define TEST_CASE_METHOD( className, name, description ) INTERNAL_CATCH_TEST_CASE_METHOD( className, name, description )
|
||||||
#define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
#define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
||||||
#define REGISTER_TEST_CASE( method, name, description ) INTERNAL_CATCH_REGISTER_TESTCASE( method, name, description )
|
#define REGISTER_TEST_CASE( method, name, description ) INTERNAL_CATCH_REGISTER_TESTCASE( method, name, description )
|
||||||
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
||||||
#define FAIL( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, "FAIL", msg )
|
#define FAIL( msg ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, msg )
|
||||||
#define SUCCEED( msg ) INTERNAL_CATCH_MSG( Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, "SUCCEED", msg )
|
#define FAIL_CHECK( msg ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, msg )
|
||||||
|
#define SUCCEED( msg ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, msg )
|
||||||
#endif
|
#endif
|
||||||
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" )
|
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "" )
|
||||||
|
|
||||||
|
@@ -125,7 +125,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showHelp( std::string const& processName ) {
|
void showHelp( std::string const& processName ) {
|
||||||
Catch::cout() << "\nCatch v" << libraryVersion << "\n";
|
Catch::cout() << "\nCatch v" << libraryVersion() << "\n";
|
||||||
|
|
||||||
m_cli.usage( Catch::cout(), processName );
|
m_cli.usage( Catch::cout(), processName );
|
||||||
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
|
Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
|
||||||
|
9
include/external/clara.h
vendored
9
include/external/clara.h
vendored
@@ -41,6 +41,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
// Use optional outer namespace
|
// Use optional outer namespace
|
||||||
#ifdef STITCH_TBC_TEXT_FORMAT_OUTER_NAMESPACE
|
#ifdef STITCH_TBC_TEXT_FORMAT_OUTER_NAMESPACE
|
||||||
@@ -397,7 +398,7 @@ namespace Clara {
|
|||||||
_dest = _source;
|
_dest = _source;
|
||||||
}
|
}
|
||||||
char toLowerCh(char c) {
|
char toLowerCh(char c) {
|
||||||
return static_cast<char>( ::tolower( c ) );
|
return static_cast<char>( std::tolower( c ) );
|
||||||
}
|
}
|
||||||
inline void convertInto( std::string const& _source, bool& _dest ) {
|
inline void convertInto( std::string const& _source, bool& _dest ) {
|
||||||
std::string sourceLC = _source;
|
std::string sourceLC = _source;
|
||||||
@@ -553,12 +554,13 @@ namespace Clara {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void parseIntoTokens( std::string const& arg, std::vector<Token>& tokens ) {
|
void parseIntoTokens( std::string const& arg, std::vector<Token>& tokens ) {
|
||||||
for( std::size_t i = 0; i <= arg.size(); ++i ) {
|
for( std::size_t i = 0; i < arg.size(); ++i ) {
|
||||||
char c = arg[i];
|
char c = arg[i];
|
||||||
if( c == '"' )
|
if( c == '"' )
|
||||||
inQuotes = !inQuotes;
|
inQuotes = !inQuotes;
|
||||||
mode = handleMode( i, c, arg, tokens );
|
mode = handleMode( i, c, arg, tokens );
|
||||||
}
|
}
|
||||||
|
mode = handleMode( arg.size(), '\0', arg, tokens );
|
||||||
}
|
}
|
||||||
Mode handleMode( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
|
Mode handleMode( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
|
||||||
switch( mode ) {
|
switch( mode ) {
|
||||||
@@ -591,6 +593,7 @@ namespace Clara {
|
|||||||
default: from = i; return ShortOpt;
|
default: from = i; return ShortOpt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Mode handleOpt( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
|
Mode handleOpt( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
|
||||||
if( std::string( ":=\0", 3 ).find( c ) == std::string::npos )
|
if( std::string( ":=\0", 3 ).find( c ) == std::string::npos )
|
||||||
return mode;
|
return mode;
|
||||||
@@ -924,7 +927,7 @@ namespace Clara {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Parser::Token> parseInto( std::vector<std::string> const& args, ConfigT& config ) const {
|
std::vector<Parser::Token> parseInto( std::vector<std::string> const& args, ConfigT& config ) const {
|
||||||
std::string processName = args[0];
|
std::string processName = args.empty() ? std::string() : args[0];
|
||||||
std::size_t lastSlash = processName.find_last_of( "/\\" );
|
std::size_t lastSlash = processName.find_last_of( "/\\" );
|
||||||
if( lastSlash != std::string::npos )
|
if( lastSlash != std::string::npos )
|
||||||
processName = processName.substr( lastSlash+1 );
|
processName = processName.substr( lastSlash+1 );
|
||||||
|
@@ -49,6 +49,12 @@ namespace Detail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS)
|
#if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS)
|
||||||
|
|
||||||
|
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
||||||
|
explicit Approx( T value ): Approx(static_cast<double>(value))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
||||||
friend bool operator == ( const T& lhs, Approx const& rhs ) {
|
friend bool operator == ( const T& lhs, Approx const& rhs ) {
|
||||||
// Thanks to Richard Harris for his help refining this formula
|
// Thanks to Richard Harris for his help refining this formula
|
||||||
@@ -76,27 +82,23 @@ namespace Detail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
||||||
friend bool operator <= ( T lhs, Approx const& rhs )
|
friend bool operator <= ( T lhs, Approx const& rhs ) {
|
||||||
{
|
return double(lhs) < rhs.m_value || lhs == rhs;
|
||||||
return double(lhs) < rhs.m_value || lhs == rhs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
||||||
friend bool operator <= ( Approx const& lhs, T rhs )
|
friend bool operator <= ( Approx const& lhs, T rhs ) {
|
||||||
{
|
return lhs.m_value < double(rhs) || lhs == rhs;
|
||||||
return lhs.m_value < double(rhs) || lhs == rhs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
||||||
friend bool operator >= ( T lhs, Approx const& rhs )
|
friend bool operator >= ( T lhs, Approx const& rhs ) {
|
||||||
{
|
return double(lhs) > rhs.m_value || lhs == rhs;
|
||||||
return double(lhs) > rhs.m_value || lhs == rhs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
||||||
friend bool operator >= ( Approx const& lhs, T rhs )
|
friend bool operator >= ( Approx const& lhs, T rhs ) {
|
||||||
{
|
return lhs.m_value > double(rhs) || lhs == rhs;
|
||||||
return lhs.m_value > double(rhs) || lhs == rhs;
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
friend bool operator == ( double lhs, Approx const& rhs ) {
|
friend bool operator == ( double lhs, Approx const& rhs ) {
|
||||||
@@ -120,24 +122,20 @@ namespace Detail {
|
|||||||
return !operator==( rhs, lhs );
|
return !operator==( rhs, lhs );
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator <= ( double lhs, Approx const& rhs )
|
friend bool operator <= ( double lhs, Approx const& rhs ) {
|
||||||
{
|
return lhs < rhs.m_value || lhs == rhs;
|
||||||
return lhs < rhs.m_value || lhs == rhs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator <= ( Approx const& lhs, double rhs )
|
friend bool operator <= ( Approx const& lhs, double rhs ) {
|
||||||
{
|
return lhs.m_value < rhs || lhs == rhs;
|
||||||
return lhs.m_value < rhs || lhs == rhs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator >= ( double lhs, Approx const& rhs )
|
friend bool operator >= ( double lhs, Approx const& rhs ) {
|
||||||
{
|
return lhs > rhs.m_value || lhs == rhs;
|
||||||
return lhs > rhs.m_value || lhs == rhs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator >= ( Approx const& lhs, double rhs )
|
friend bool operator >= ( Approx const& lhs, double rhs ) {
|
||||||
{
|
return lhs.m_value > rhs || lhs == rhs;
|
||||||
return lhs.m_value > rhs || lhs == rhs;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
#include "catch_tostring.h"
|
#include "catch_tostring.h"
|
||||||
#include "catch_interfaces_runner.h"
|
#include "catch_interfaces_runner.h"
|
||||||
#include "catch_compiler_capabilities.h"
|
#include "catch_compiler_capabilities.h"
|
||||||
#include "catch_type_traits.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(CATCH_CONFIG_FAST_COMPILE)
|
#if defined(CATCH_CONFIG_FAST_COMPILE)
|
||||||
@@ -26,6 +25,33 @@
|
|||||||
// macro in each assertion
|
// macro in each assertion
|
||||||
#define INTERNAL_CATCH_REACT( resultBuilder ) \
|
#define INTERNAL_CATCH_REACT( resultBuilder ) \
|
||||||
resultBuilder.react();
|
resultBuilder.react();
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Another way to speed-up compilation is to omit local try-catch for REQUIRE*
|
||||||
|
// macros.
|
||||||
|
// This can potentially cause false negative, if the test code catches
|
||||||
|
// the exception before it propagates back up to the runner.
|
||||||
|
#define INTERNAL_CATCH_TEST_NO_TRY( macroName, resultDisposition, expr ) \
|
||||||
|
do { \
|
||||||
|
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
|
||||||
|
__catchResult.setExceptionGuard(); \
|
||||||
|
CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
|
||||||
|
( __catchResult <= expr ).endExpression(); \
|
||||||
|
CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
|
||||||
|
__catchResult.unsetExceptionGuard(); \
|
||||||
|
INTERNAL_CATCH_REACT( __catchResult ) \
|
||||||
|
} while( Catch::isTrue( false && static_cast<bool>( !!(expr) ) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
|
||||||
|
// The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.
|
||||||
|
|
||||||
|
#define INTERNAL_CHECK_THAT_NO_TRY( macroName, matcher, resultDisposition, arg ) \
|
||||||
|
do { \
|
||||||
|
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #arg ", " #matcher, resultDisposition ); \
|
||||||
|
__catchResult.setExceptionGuard(); \
|
||||||
|
__catchResult.captureMatch( arg, matcher, #matcher ); \
|
||||||
|
__catchResult.unsetExceptionGuard(); \
|
||||||
|
INTERNAL_CATCH_REACT( __catchResult ) \
|
||||||
|
} while( Catch::alwaysFalse() )
|
||||||
|
|
||||||
#else
|
#else
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// In the event of a failure works out if the debugger needs to be invoked
|
// In the event of a failure works out if the debugger needs to be invoked
|
||||||
@@ -39,7 +65,7 @@
|
|||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ) \
|
#define INTERNAL_CATCH_TEST( macroName, resultDisposition, expr ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
|
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
|
||||||
try { \
|
try { \
|
||||||
@@ -55,17 +81,17 @@
|
|||||||
// The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.
|
// The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \
|
#define INTERNAL_CATCH_IF( macroName, resultDisposition, expr ) \
|
||||||
INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ); \
|
INTERNAL_CATCH_TEST( macroName, resultDisposition, expr ); \
|
||||||
if( Catch::getResultCapture().getLastResult()->succeeded() )
|
if( Catch::getResultCapture().getLastResult()->succeeded() )
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_ELSE( expr, resultDisposition, macroName ) \
|
#define INTERNAL_CATCH_ELSE( macroName, resultDisposition, expr ) \
|
||||||
INTERNAL_CATCH_TEST( expr, resultDisposition, macroName ); \
|
INTERNAL_CATCH_TEST( macroName, resultDisposition, expr ); \
|
||||||
if( !Catch::getResultCapture().getLastResult()->succeeded() )
|
if( !Catch::getResultCapture().getLastResult()->succeeded() )
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_NO_THROW( expr, resultDisposition, macroName ) \
|
#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, expr ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
|
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \
|
||||||
try { \
|
try { \
|
||||||
@@ -79,7 +105,7 @@
|
|||||||
} while( Catch::alwaysFalse() )
|
} while( Catch::alwaysFalse() )
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_THROWS( expr, resultDisposition, matcher, macroName ) \
|
#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, matcher, expr ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition, #matcher ); \
|
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition, #matcher ); \
|
||||||
if( __catchResult.allowThrows() ) \
|
if( __catchResult.allowThrows() ) \
|
||||||
@@ -96,7 +122,7 @@
|
|||||||
} while( Catch::alwaysFalse() )
|
} while( Catch::alwaysFalse() )
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_THROWS_AS( expr, exceptionType, resultDisposition, macroName ) \
|
#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr ", " #exceptionType, resultDisposition ); \
|
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr ", " #exceptionType, resultDisposition ); \
|
||||||
if( __catchResult.allowThrows() ) \
|
if( __catchResult.allowThrows() ) \
|
||||||
@@ -104,7 +130,7 @@
|
|||||||
static_cast<void>(expr); \
|
static_cast<void>(expr); \
|
||||||
__catchResult.captureResult( Catch::ResultWas::DidntThrowException ); \
|
__catchResult.captureResult( Catch::ResultWas::DidntThrowException ); \
|
||||||
} \
|
} \
|
||||||
catch( Catch::add_const<Catch::add_lvalue_reference<exceptionType>::type>::type ) { \
|
catch( exceptionType ) { \
|
||||||
__catchResult.captureResult( Catch::ResultWas::Ok ); \
|
__catchResult.captureResult( Catch::ResultWas::Ok ); \
|
||||||
} \
|
} \
|
||||||
catch( ... ) { \
|
catch( ... ) { \
|
||||||
@@ -118,7 +144,7 @@
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
||||||
#define INTERNAL_CATCH_MSG( messageType, resultDisposition, macroName, ... ) \
|
#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \
|
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \
|
||||||
__catchResult << __VA_ARGS__ + ::Catch::StreamEndStop(); \
|
__catchResult << __VA_ARGS__ + ::Catch::StreamEndStop(); \
|
||||||
@@ -136,11 +162,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_INFO( log, macroName ) \
|
#define INTERNAL_CATCH_INFO( macroName, log ) \
|
||||||
Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage ) = Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log;
|
Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage ) = Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CHECK_THAT( arg, matcher, resultDisposition, macroName ) \
|
#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \
|
||||||
do { \
|
do { \
|
||||||
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #arg ", " #matcher, resultDisposition ); \
|
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #arg ", " #matcher, resultDisposition ); \
|
||||||
try { \
|
try { \
|
||||||
|
@@ -63,6 +63,12 @@
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(CATCH_CPP11_OR_GREATER)
|
# if defined(CATCH_CPP11_OR_GREATER)
|
||||||
|
# define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
||||||
|
_Pragma( "clang diagnostic push" ) \
|
||||||
|
_Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" )
|
||||||
|
# define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
|
||||||
|
_Pragma( "clang diagnostic pop" )
|
||||||
|
|
||||||
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
|
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
|
||||||
_Pragma( "clang diagnostic push" ) \
|
_Pragma( "clang diagnostic push" ) \
|
||||||
_Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
|
_Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
|
||||||
@@ -112,23 +118,10 @@
|
|||||||
// GCC
|
// GCC
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
|
||||||
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
|
|
||||||
# define CATCH_GCC_HAS_NEW_PRAGMA
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__)
|
# if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||||
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) && defined(CATCH_GCC_HAS_NEW_PRAGMA)
|
|
||||||
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
|
|
||||||
_Pragma( "GCC diagnostic push" ) \
|
|
||||||
_Pragma( "GCC diagnostic ignored \"-Wparentheses\"" )
|
|
||||||
# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
|
|
||||||
_Pragma( "GCC diagnostic pop" )
|
|
||||||
# endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// - otherwise more recent versions define __cplusplus >= 201103L
|
// - otherwise more recent versions define __cplusplus >= 201103L
|
||||||
// and will get picked up below
|
// and will get picked up below
|
||||||
@@ -270,7 +263,7 @@
|
|||||||
# define CATCH_CONFIG_WINDOWS_SEH
|
# define CATCH_CONFIG_WINDOWS_SEH
|
||||||
#endif
|
#endif
|
||||||
// This is set by default, because we assume that unix compilers are posix-signal-compatible by default.
|
// This is set by default, because we assume that unix compilers are posix-signal-compatible by default.
|
||||||
#if !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)
|
#if !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)
|
||||||
# define CATCH_CONFIG_POSIX_SIGNALS
|
# define CATCH_CONFIG_POSIX_SIGNALS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -278,6 +271,10 @@
|
|||||||
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
|
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
|
||||||
# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
|
# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS)
|
||||||
|
# define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS
|
||||||
|
# define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
|
||||||
|
#endif
|
||||||
|
|
||||||
// noexcept support:
|
// noexcept support:
|
||||||
#if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT)
|
#if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT)
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#define TWOBLUECUBES_CATCH_CONSOLE_COLOUR_IMPL_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_CONSOLE_COLOUR_IMPL_HPP_INCLUDED
|
||||||
|
|
||||||
#include "catch_console_colour.hpp"
|
#include "catch_console_colour.hpp"
|
||||||
|
#include "catch_errno_guard.hpp"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace {
|
namespace {
|
||||||
@@ -148,6 +149,7 @@ namespace {
|
|||||||
};
|
};
|
||||||
|
|
||||||
IColourImpl* platformColourInstance() {
|
IColourImpl* platformColourInstance() {
|
||||||
|
ErrnoGuard guard;
|
||||||
Ptr<IConfig const> config = getCurrentContext().getConfig();
|
Ptr<IConfig const> config = getCurrentContext().getConfig();
|
||||||
UseColour::YesOrNo colourMode = config
|
UseColour::YesOrNo colourMode = config
|
||||||
? config->useColour()
|
? config->useColour()
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#define TWOBLUECUBES_CATCH_DEBUGGER_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_DEBUGGER_HPP_INCLUDED
|
||||||
|
|
||||||
#include "catch_debugger.h"
|
#include "catch_debugger.h"
|
||||||
|
#include "catch_errno_guard.hpp"
|
||||||
|
|
||||||
#ifdef CATCH_PLATFORM_MAC
|
#ifdef CATCH_PLATFORM_MAC
|
||||||
|
|
||||||
@@ -72,6 +73,9 @@
|
|||||||
// be strace, for example) in /proc/$PID/status, so just get it from
|
// be strace, for example) in /proc/$PID/status, so just get it from
|
||||||
// there instead.
|
// there instead.
|
||||||
bool isDebuggerActive(){
|
bool isDebuggerActive(){
|
||||||
|
// Libstdc++ has a bug, where std::ifstream sets errno to 0
|
||||||
|
// This way our users can properly assert over errno values
|
||||||
|
ErrnoGuard guard;
|
||||||
std::ifstream in("/proc/self/status");
|
std::ifstream in("/proc/self/status");
|
||||||
for( std::string line; std::getline(in, line); ) {
|
for( std::string line; std::getline(in, line); ) {
|
||||||
static const int PREFIX_LEN = 11;
|
static const int PREFIX_LEN = 11;
|
||||||
|
25
include/internal/catch_errno_guard.hpp
Normal file
25
include/internal/catch_errno_guard.hpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Created by Martin on 06/03/2017.
|
||||||
|
*
|
||||||
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
#ifndef TWOBLUECUBES_CATCH_ERRNO_GUARD_HPP_INCLUDED
|
||||||
|
#define TWOBLUECUBES_CATCH_ERRNO_GUARD_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include <cerrno>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
|
||||||
|
class ErrnoGuard {
|
||||||
|
public:
|
||||||
|
ErrnoGuard():m_oldErrno(errno){}
|
||||||
|
~ErrnoGuard() { errno = m_oldErrno; }
|
||||||
|
private:
|
||||||
|
int m_oldErrno;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // TWOBLUECUBES_CATCH_ERRNO_GUARD_HPP_INCLUDED
|
@@ -53,7 +53,6 @@ namespace Catch {
|
|||||||
static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
|
static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
|
||||||
for (int i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
|
for (int i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
|
||||||
if (ExceptionInfo->ExceptionRecord->ExceptionCode == signalDefs[i].id) {
|
if (ExceptionInfo->ExceptionRecord->ExceptionCode == signalDefs[i].id) {
|
||||||
reset();
|
|
||||||
reportFatal(signalDefs[i].name);
|
reportFatal(signalDefs[i].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "catch_context.h"
|
#include "catch_context.h"
|
||||||
|
|
||||||
#include <iterator>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -124,7 +123,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
void move( CompositeGenerator& other ) {
|
void move( CompositeGenerator& other ) {
|
||||||
std::copy( other.m_composed.begin(), other.m_composed.end(), std::back_inserter( m_composed ) );
|
m_composed.insert( m_composed.end(), other.m_composed.begin(), other.m_composed.end() );
|
||||||
m_totalSize += other.m_totalSize;
|
m_totalSize += other.m_totalSize;
|
||||||
other.m_composed.clear();
|
other.m_composed.clear();
|
||||||
}
|
}
|
||||||
|
@@ -91,6 +91,7 @@ namespace Catch {
|
|||||||
TestSpec::NamePattern::~NamePattern() {}
|
TestSpec::NamePattern::~NamePattern() {}
|
||||||
TestSpec::TagPattern::~TagPattern() {}
|
TestSpec::TagPattern::~TagPattern() {}
|
||||||
TestSpec::ExcludedPattern::~ExcludedPattern() {}
|
TestSpec::ExcludedPattern::~ExcludedPattern() {}
|
||||||
|
Matchers::Impl::MatcherUntypedBase::~MatcherUntypedBase() {}
|
||||||
|
|
||||||
void Config::dummy() {}
|
void Config::dummy() {}
|
||||||
|
|
||||||
|
@@ -38,6 +38,8 @@ namespace Catch {
|
|||||||
virtual std::string getCurrentTestName() const = 0;
|
virtual std::string getCurrentTestName() const = 0;
|
||||||
virtual const AssertionResult* getLastResult() const = 0;
|
virtual const AssertionResult* getLastResult() const = 0;
|
||||||
|
|
||||||
|
virtual void exceptionEarlyReported() = 0;
|
||||||
|
|
||||||
virtual void handleFatalErrorCondition( std::string const& message ) = 0;
|
virtual void handleFatalErrorCondition( std::string const& message ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -20,12 +20,15 @@ namespace Catch {
|
|||||||
struct IExceptionTranslator;
|
struct IExceptionTranslator;
|
||||||
struct IReporterRegistry;
|
struct IReporterRegistry;
|
||||||
struct IReporterFactory;
|
struct IReporterFactory;
|
||||||
|
struct ITagAliasRegistry;
|
||||||
|
|
||||||
struct IRegistryHub {
|
struct IRegistryHub {
|
||||||
virtual ~IRegistryHub();
|
virtual ~IRegistryHub();
|
||||||
|
|
||||||
virtual IReporterRegistry const& getReporterRegistry() const = 0;
|
virtual IReporterRegistry const& getReporterRegistry() const = 0;
|
||||||
virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0;
|
virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0;
|
||||||
|
virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0;
|
||||||
|
|
||||||
virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() = 0;
|
virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -35,6 +38,7 @@ namespace Catch {
|
|||||||
virtual void registerListener( Ptr<IReporterFactory> const& factory ) = 0;
|
virtual void registerListener( Ptr<IReporterFactory> const& factory ) = 0;
|
||||||
virtual void registerTest( TestCase const& testInfo ) = 0;
|
virtual void registerTest( TestCase const& testInfo ) = 0;
|
||||||
virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
|
virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
|
||||||
|
virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
IRegistryHub& getRegistryHub();
|
IRegistryHub& getRegistryHub();
|
||||||
|
@@ -27,16 +27,25 @@ namespace Matchers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual ~MatcherUntypedBase();
|
||||||
virtual std::string describe() const = 0;
|
virtual std::string describe() const = 0;
|
||||||
mutable std::string m_cachedToString;
|
mutable std::string m_cachedToString;
|
||||||
private:
|
private:
|
||||||
MatcherUntypedBase& operator = ( MatcherUntypedBase const& );
|
MatcherUntypedBase& operator = ( MatcherUntypedBase const& );
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename ObjectT, typename ComparatorT = ObjectT>
|
template<typename ObjectT>
|
||||||
struct MatcherBase : MatcherUntypedBase {
|
struct MatcherMethod {
|
||||||
|
|
||||||
virtual bool match( ObjectT const& arg ) const = 0;
|
virtual bool match( ObjectT const& arg ) const = 0;
|
||||||
|
};
|
||||||
|
template<typename PtrT>
|
||||||
|
struct MatcherMethod<PtrT*> {
|
||||||
|
virtual bool match( PtrT* arg ) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename ObjectT, typename ComparatorT = ObjectT>
|
||||||
|
struct MatcherBase : MatcherUntypedBase, MatcherMethod<ObjectT> {
|
||||||
|
|
||||||
|
|
||||||
MatchAllOf<ComparatorT> operator && ( MatcherBase const& other ) const;
|
MatchAllOf<ComparatorT> operator && ( MatcherBase const& other ) const;
|
||||||
MatchAnyOf<ComparatorT> operator || ( MatcherBase const& other ) const;
|
MatchAnyOf<ComparatorT> operator || ( MatcherBase const& other ) const;
|
||||||
|
@@ -26,7 +26,7 @@ namespace Matchers {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct StringMatcherBase : MatcherBase<std::string> {
|
struct StringMatcherBase : MatcherBase<std::string> {
|
||||||
StringMatcherBase( std::string operation, CasedString const& comparator );
|
StringMatcherBase( std::string const& operation, CasedString const& comparator );
|
||||||
virtual std::string describe() const CATCH_OVERRIDE;
|
virtual std::string describe() const CATCH_OVERRIDE;
|
||||||
|
|
||||||
CasedString m_comparator;
|
CasedString m_comparator;
|
||||||
|
@@ -29,7 +29,7 @@ namespace Matchers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
StringMatcherBase::StringMatcherBase( std::string operation, CasedString const& comparator )
|
StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator )
|
||||||
: m_comparator( comparator ),
|
: m_comparator( comparator ),
|
||||||
m_operation( operation ) {
|
m_operation( operation ) {
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,9 @@ namespace Catch {
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
ScopedMessage::~ScopedMessage() {
|
ScopedMessage::~ScopedMessage() {
|
||||||
getResultCapture().popScopedMessage( m_info );
|
if ( !std::uncaught_exception() ){
|
||||||
|
getResultCapture().popScopedMessage(m_info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -104,65 +104,68 @@ namespace Catch {
|
|||||||
namespace Matchers {
|
namespace Matchers {
|
||||||
namespace Impl {
|
namespace Impl {
|
||||||
namespace NSStringMatchers {
|
namespace NSStringMatchers {
|
||||||
|
|
||||||
template<typename MatcherT>
|
struct StringHolder : MatcherBase<NSString*>{
|
||||||
struct StringHolder : MatcherImpl<MatcherT, NSString*>{
|
|
||||||
StringHolder( NSString* substr ) : m_substr( [substr copy] ){}
|
StringHolder( NSString* substr ) : m_substr( [substr copy] ){}
|
||||||
StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){}
|
StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){}
|
||||||
StringHolder() {
|
StringHolder() {
|
||||||
arcSafeRelease( m_substr );
|
arcSafeRelease( m_substr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool match( NSString* arg ) const CATCH_OVERRIDE {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
NSString* m_substr;
|
NSString* m_substr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Equals : StringHolder<Equals> {
|
struct Equals : StringHolder {
|
||||||
Equals( NSString* substr ) : StringHolder( substr ){}
|
Equals( NSString* substr ) : StringHolder( substr ){}
|
||||||
|
|
||||||
virtual bool match( ExpressionType const& str ) const {
|
virtual bool match( NSString* str ) const CATCH_OVERRIDE {
|
||||||
return (str != nil || m_substr == nil ) &&
|
return (str != nil || m_substr == nil ) &&
|
||||||
[str isEqualToString:m_substr];
|
[str isEqualToString:m_substr];
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::string toString() const {
|
virtual std::string describe() const CATCH_OVERRIDE {
|
||||||
return "equals string: " + Catch::toString( m_substr );
|
return "equals string: " + Catch::toString( m_substr );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Contains : StringHolder<Contains> {
|
struct Contains : StringHolder {
|
||||||
Contains( NSString* substr ) : StringHolder( substr ){}
|
Contains( NSString* substr ) : StringHolder( substr ){}
|
||||||
|
|
||||||
virtual bool match( ExpressionType const& str ) const {
|
virtual bool match( NSString* str ) const {
|
||||||
return (str != nil || m_substr == nil ) &&
|
return (str != nil || m_substr == nil ) &&
|
||||||
[str rangeOfString:m_substr].location != NSNotFound;
|
[str rangeOfString:m_substr].location != NSNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::string toString() const {
|
virtual std::string describe() const CATCH_OVERRIDE {
|
||||||
return "contains string: " + Catch::toString( m_substr );
|
return "contains string: " + Catch::toString( m_substr );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct StartsWith : StringHolder<StartsWith> {
|
struct StartsWith : StringHolder {
|
||||||
StartsWith( NSString* substr ) : StringHolder( substr ){}
|
StartsWith( NSString* substr ) : StringHolder( substr ){}
|
||||||
|
|
||||||
virtual bool match( ExpressionType const& str ) const {
|
virtual bool match( NSString* str ) const {
|
||||||
return (str != nil || m_substr == nil ) &&
|
return (str != nil || m_substr == nil ) &&
|
||||||
[str rangeOfString:m_substr].location == 0;
|
[str rangeOfString:m_substr].location == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::string toString() const {
|
virtual std::string describe() const CATCH_OVERRIDE {
|
||||||
return "starts with: " + Catch::toString( m_substr );
|
return "starts with: " + Catch::toString( m_substr );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
struct EndsWith : StringHolder<EndsWith> {
|
struct EndsWith : StringHolder {
|
||||||
EndsWith( NSString* substr ) : StringHolder( substr ){}
|
EndsWith( NSString* substr ) : StringHolder( substr ){}
|
||||||
|
|
||||||
virtual bool match( ExpressionType const& str ) const {
|
virtual bool match( NSString* str ) const {
|
||||||
return (str != nil || m_substr == nil ) &&
|
return (str != nil || m_substr == nil ) &&
|
||||||
[str rangeOfString:m_substr].location == [str length] - [m_substr length];
|
[str rangeOfString:m_substr].location == [str length] - [m_substr length];
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::string toString() const {
|
virtual std::string describe() const CATCH_OVERRIDE {
|
||||||
return "ends with: " + Catch::toString( m_substr );
|
return "ends with: " + Catch::toString( m_substr );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include "catch_test_case_registry_impl.hpp"
|
#include "catch_test_case_registry_impl.hpp"
|
||||||
#include "catch_reporter_registry.hpp"
|
#include "catch_reporter_registry.hpp"
|
||||||
#include "catch_exception_translator_registry.hpp"
|
#include "catch_exception_translator_registry.hpp"
|
||||||
|
#include "catch_tag_alias_registry.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
@@ -35,6 +36,10 @@ namespace Catch {
|
|||||||
virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() CATCH_OVERRIDE {
|
virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() CATCH_OVERRIDE {
|
||||||
return m_exceptionTranslatorRegistry;
|
return m_exceptionTranslatorRegistry;
|
||||||
}
|
}
|
||||||
|
virtual ITagAliasRegistry const& getTagAliasRegistry() const CATCH_OVERRIDE {
|
||||||
|
return m_tagAliasRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public: // IMutableRegistryHub
|
public: // IMutableRegistryHub
|
||||||
virtual void registerReporter( std::string const& name, Ptr<IReporterFactory> const& factory ) CATCH_OVERRIDE {
|
virtual void registerReporter( std::string const& name, Ptr<IReporterFactory> const& factory ) CATCH_OVERRIDE {
|
||||||
@@ -49,11 +54,15 @@ namespace Catch {
|
|||||||
virtual void registerTranslator( const IExceptionTranslator* translator ) CATCH_OVERRIDE {
|
virtual void registerTranslator( const IExceptionTranslator* translator ) CATCH_OVERRIDE {
|
||||||
m_exceptionTranslatorRegistry.registerTranslator( translator );
|
m_exceptionTranslatorRegistry.registerTranslator( translator );
|
||||||
}
|
}
|
||||||
|
virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) CATCH_OVERRIDE {
|
||||||
|
m_tagAliasRegistry.add( alias, tag, lineInfo );
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TestRegistry m_testCaseRegistry;
|
TestRegistry m_testCaseRegistry;
|
||||||
ReporterRegistry m_reporterRegistry;
|
ReporterRegistry m_reporterRegistry;
|
||||||
ExceptionTranslatorRegistry m_exceptionTranslatorRegistry;
|
ExceptionTranslatorRegistry m_exceptionTranslatorRegistry;
|
||||||
|
TagAliasRegistry m_tagAliasRegistry;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Single, global, instance
|
// Single, global, instance
|
||||||
|
@@ -92,7 +92,11 @@ namespace Catch {
|
|||||||
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
|
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
|
||||||
namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); }
|
namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); }
|
||||||
|
|
||||||
|
// Deprecated - use the form without INTERNAL_
|
||||||
#define INTERNAL_CATCH_REGISTER_LISTENER( listenerType ) \
|
#define INTERNAL_CATCH_REGISTER_LISTENER( listenerType ) \
|
||||||
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
|
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
|
||||||
|
|
||||||
|
#define CATCH_REGISTER_LISTENER( listenerType ) \
|
||||||
|
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
|
||||||
|
@@ -39,6 +39,7 @@ namespace Catch {
|
|||||||
char const* capturedExpression,
|
char const* capturedExpression,
|
||||||
ResultDisposition::Flags resultDisposition,
|
ResultDisposition::Flags resultDisposition,
|
||||||
char const* secondArg = "" );
|
char const* secondArg = "" );
|
||||||
|
~ResultBuilder();
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ExpressionLhs<T const&> operator <= ( T const& operand );
|
ExpressionLhs<T const&> operator <= ( T const& operand );
|
||||||
@@ -73,6 +74,9 @@ namespace Catch {
|
|||||||
template<typename ArgT, typename MatcherT>
|
template<typename ArgT, typename MatcherT>
|
||||||
void captureMatch( ArgT const& arg, MatcherT const& matcher, char const* matcherString );
|
void captureMatch( ArgT const& arg, MatcherT const& matcher, char const* matcherString );
|
||||||
|
|
||||||
|
void setExceptionGuard();
|
||||||
|
void unsetExceptionGuard();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AssertionInfo m_assertionInfo;
|
AssertionInfo m_assertionInfo;
|
||||||
AssertionResultData m_data;
|
AssertionResultData m_data;
|
||||||
@@ -80,6 +84,7 @@ namespace Catch {
|
|||||||
|
|
||||||
bool m_shouldDebugBreak;
|
bool m_shouldDebugBreak;
|
||||||
bool m_shouldThrow;
|
bool m_shouldThrow;
|
||||||
|
bool m_guardException;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
@@ -30,9 +30,20 @@ namespace Catch {
|
|||||||
char const* secondArg )
|
char const* secondArg )
|
||||||
: m_assertionInfo( macroName, lineInfo, capturedExpressionWithSecondArgument( capturedExpression, secondArg ), resultDisposition ),
|
: m_assertionInfo( macroName, lineInfo, capturedExpressionWithSecondArgument( capturedExpression, secondArg ), resultDisposition ),
|
||||||
m_shouldDebugBreak( false ),
|
m_shouldDebugBreak( false ),
|
||||||
m_shouldThrow( false )
|
m_shouldThrow( false ),
|
||||||
|
m_guardException( false )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
ResultBuilder::~ResultBuilder() {
|
||||||
|
#if defined(CATCH_CONFIG_FAST_COMPILE)
|
||||||
|
if ( m_guardException ) {
|
||||||
|
m_stream.oss << "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE";
|
||||||
|
captureResult( ResultWas::ThrewException );
|
||||||
|
getCurrentContext().getResultCapture()->exceptionEarlyReported();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
ResultBuilder& ResultBuilder::setResultType( ResultWas::OfType result ) {
|
ResultBuilder& ResultBuilder::setResultType( ResultWas::OfType result ) {
|
||||||
m_data.resultType = result;
|
m_data.resultType = result;
|
||||||
return *this;
|
return *this;
|
||||||
@@ -146,6 +157,13 @@ namespace Catch {
|
|||||||
dest = m_assertionInfo.capturedExpression;
|
dest = m_assertionInfo.capturedExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResultBuilder::setExceptionGuard() {
|
||||||
|
m_guardException = true;
|
||||||
|
}
|
||||||
|
void ResultBuilder::unsetExceptionGuard() {
|
||||||
|
m_guardException = false;
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_RESULT_BUILDER_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_RESULT_BUILDER_HPP_INCLUDED
|
||||||
|
@@ -64,7 +64,8 @@ namespace Catch {
|
|||||||
m_context( getCurrentMutableContext() ),
|
m_context( getCurrentMutableContext() ),
|
||||||
m_activeTestCase( CATCH_NULL ),
|
m_activeTestCase( CATCH_NULL ),
|
||||||
m_config( _config ),
|
m_config( _config ),
|
||||||
m_reporter( reporter )
|
m_reporter( reporter ),
|
||||||
|
m_shouldReportUnexpected ( true )
|
||||||
{
|
{
|
||||||
m_context.setRunner( this );
|
m_context.setRunner( this );
|
||||||
m_context.setConfig( m_config );
|
m_context.setConfig( m_config );
|
||||||
@@ -223,11 +224,19 @@ namespace Catch {
|
|||||||
return &m_lastResult;
|
return &m_lastResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void exceptionEarlyReported() {
|
||||||
|
m_shouldReportUnexpected = false;
|
||||||
|
}
|
||||||
|
|
||||||
virtual void handleFatalErrorCondition( std::string const& message ) {
|
virtual void handleFatalErrorCondition( std::string const& message ) {
|
||||||
ResultBuilder resultBuilder = makeUnexpectedResultBuilder();
|
// Don't rebuild the result -- the stringification itself can cause more fatal errors
|
||||||
resultBuilder.setResultType( ResultWas::FatalErrorCondition );
|
// Instead, fake a result data.
|
||||||
resultBuilder << message;
|
AssertionResultData tempResult;
|
||||||
resultBuilder.captureExpression();
|
tempResult.resultType = ResultWas::FatalErrorCondition;
|
||||||
|
tempResult.message = message;
|
||||||
|
AssertionResult result(m_lastAssertionInfo, tempResult);
|
||||||
|
|
||||||
|
getResultCapture().assertionEnded(result);
|
||||||
|
|
||||||
handleUnfinishedSections();
|
handleUnfinishedSections();
|
||||||
|
|
||||||
@@ -268,6 +277,7 @@ namespace Catch {
|
|||||||
m_reporter->sectionStarting( testCaseSection );
|
m_reporter->sectionStarting( testCaseSection );
|
||||||
Counts prevAssertions = m_totals.assertions;
|
Counts prevAssertions = m_totals.assertions;
|
||||||
double duration = 0;
|
double duration = 0;
|
||||||
|
m_shouldReportUnexpected = true;
|
||||||
try {
|
try {
|
||||||
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, std::string(), ResultDisposition::Normal );
|
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, std::string(), ResultDisposition::Normal );
|
||||||
|
|
||||||
@@ -289,7 +299,11 @@ namespace Catch {
|
|||||||
// This just means the test was aborted due to failure
|
// This just means the test was aborted due to failure
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch(...) {
|
||||||
makeUnexpectedResultBuilder().useActiveException();
|
// Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions
|
||||||
|
// are reported without translation at the point of origin.
|
||||||
|
if (m_shouldReportUnexpected) {
|
||||||
|
makeUnexpectedResultBuilder().useActiveException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_testCaseTracker->close();
|
m_testCaseTracker->close();
|
||||||
handleUnfinishedSections();
|
handleUnfinishedSections();
|
||||||
@@ -349,6 +363,7 @@ namespace Catch {
|
|||||||
std::vector<SectionEndInfo> m_unfinishedSections;
|
std::vector<SectionEndInfo> m_unfinishedSections;
|
||||||
std::vector<ITracker*> m_activeSections;
|
std::vector<ITracker*> m_activeSections;
|
||||||
TrackerContext m_trackerContext;
|
TrackerContext m_trackerContext;
|
||||||
|
bool m_shouldReportUnexpected;
|
||||||
};
|
};
|
||||||
|
|
||||||
IResultCapture& getResultCapture() {
|
IResultCapture& getResultCapture() {
|
||||||
|
@@ -24,11 +24,7 @@
|
|||||||
#elif defined __GNUC__
|
#elif defined __GNUC__
|
||||||
# pragma GCC diagnostic ignored "-Wvariadic-macros"
|
# pragma GCC diagnostic ignored "-Wvariadic-macros"
|
||||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||||
|
# pragma GCC diagnostic ignored "-Wparentheses"
|
||||||
// For newer version we can use __Pragma to disable the warnings locally
|
|
||||||
# if __GNUC__ == 4 && __GNUC_MINOR__ >= 4 && __GNUC_MINOR__ <= 7
|
|
||||||
# pragma GCC diagnostic ignored "-Wparentheses"
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# pragma GCC diagnostic push
|
# pragma GCC diagnostic push
|
||||||
# pragma GCC diagnostic ignored "-Wpadded"
|
# pragma GCC diagnostic ignored "-Wpadded"
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct TagAlias {
|
struct TagAlias {
|
||||||
TagAlias( std::string _tag, SourceLineInfo _lineInfo ) : tag( _tag ), lineInfo( _lineInfo ) {}
|
TagAlias( std::string const& _tag, SourceLineInfo _lineInfo ) : tag( _tag ), lineInfo( _lineInfo ) {}
|
||||||
|
|
||||||
std::string tag;
|
std::string tag;
|
||||||
SourceLineInfo lineInfo;
|
SourceLineInfo lineInfo;
|
||||||
|
@@ -19,8 +19,7 @@ namespace Catch {
|
|||||||
virtual ~TagAliasRegistry();
|
virtual ~TagAliasRegistry();
|
||||||
virtual Option<TagAlias> find( std::string const& alias ) const;
|
virtual Option<TagAlias> find( std::string const& alias ) const;
|
||||||
virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const;
|
virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const;
|
||||||
void add( char const* alias, char const* tag, SourceLineInfo const& lineInfo );
|
void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo );
|
||||||
static TagAliasRegistry& get();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, TagAlias> m_registry;
|
std::map<std::string, TagAlias> m_registry;
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include "catch_tag_alias_registry.h"
|
#include "catch_tag_alias_registry.h"
|
||||||
#include "catch_console_colour.hpp"
|
#include "catch_console_colour.hpp"
|
||||||
|
#include "catch_interfaces_registry_hub.h"
|
||||||
|
#include "catch_stream.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
@@ -38,41 +40,36 @@ namespace Catch {
|
|||||||
return expandedTestSpec;
|
return expandedTestSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TagAliasRegistry::add( char const* alias, char const* tag, SourceLineInfo const& lineInfo ) {
|
void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) {
|
||||||
|
|
||||||
if( !startsWith( alias, "[@" ) || !endsWith( alias, ']' ) ) {
|
if( !startsWith( alias, "[@" ) || !endsWith( alias, ']' ) ) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "error: tag alias, \"" << alias << "\" is not of the form [@alias name].\n" << lineInfo;
|
oss << Colour( Colour::Red )
|
||||||
|
<< "error: tag alias, \"" << alias << "\" is not of the form [@alias name].\n"
|
||||||
|
<< Colour( Colour::FileName )
|
||||||
|
<< lineInfo << '\n';
|
||||||
throw std::domain_error( oss.str().c_str() );
|
throw std::domain_error( oss.str().c_str() );
|
||||||
}
|
}
|
||||||
if( !m_registry.insert( std::make_pair( alias, TagAlias( tag, lineInfo ) ) ).second ) {
|
if( !m_registry.insert( std::make_pair( alias, TagAlias( tag, lineInfo ) ) ).second ) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "error: tag alias, \"" << alias << "\" already registered.\n"
|
oss << Colour( Colour::Red )
|
||||||
<< "\tFirst seen at " << find(alias)->lineInfo << '\n'
|
<< "error: tag alias, \"" << alias << "\" already registered.\n"
|
||||||
<< "\tRedefined at " << lineInfo;
|
<< "\tFirst seen at "
|
||||||
|
<< Colour( Colour::Red ) << find(alias)->lineInfo << '\n'
|
||||||
|
<< Colour( Colour::Red ) << "\tRedefined at "
|
||||||
|
<< Colour( Colour::FileName) << lineInfo << '\n';
|
||||||
throw std::domain_error( oss.str().c_str() );
|
throw std::domain_error( oss.str().c_str() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TagAliasRegistry& TagAliasRegistry::get() {
|
ITagAliasRegistry::~ITagAliasRegistry() {}
|
||||||
static TagAliasRegistry instance;
|
|
||||||
return instance;
|
|
||||||
|
|
||||||
|
ITagAliasRegistry const& ITagAliasRegistry::get() {
|
||||||
|
return getRegistryHub().getTagAliasRegistry();
|
||||||
}
|
}
|
||||||
|
|
||||||
ITagAliasRegistry::~ITagAliasRegistry() {}
|
|
||||||
ITagAliasRegistry const& ITagAliasRegistry::get() { return TagAliasRegistry::get(); }
|
|
||||||
|
|
||||||
|
|
||||||
RegistrarForTagAliases::RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ) {
|
RegistrarForTagAliases::RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ) {
|
||||||
try {
|
getMutableRegistryHub().registerTagAlias( alias, tag, lineInfo );
|
||||||
TagAliasRegistry::get().add( alias, tag, lineInfo );
|
|
||||||
}
|
|
||||||
catch( std::exception& ex ) {
|
|
||||||
Colour colourGuard( Colour::Red );
|
|
||||||
Catch::cerr() << ex.what() << std::endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
@@ -38,17 +38,13 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
inline void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
|
inline void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
|
||||||
if( isReservedTag( tag ) ) {
|
if( isReservedTag( tag ) ) {
|
||||||
{
|
std::ostringstream ss;
|
||||||
Colour colourGuard( Colour::Red );
|
ss << Colour(Colour::Red)
|
||||||
Catch::cerr()
|
<< "Tag name [" << tag << "] not allowed.\n"
|
||||||
<< "Tag name [" << tag << "] not allowed.\n"
|
<< "Tag names starting with non alpha-numeric characters are reserved\n"
|
||||||
<< "Tag names starting with non alpha-numeric characters are reserved\n";
|
<< Colour(Colour::FileName)
|
||||||
}
|
<< _lineInfo << '\n';
|
||||||
{
|
throw std::runtime_error(ss.str());
|
||||||
Colour colourGuard( Colour::FileName );
|
|
||||||
Catch::cerr() << _lineInfo << std::endl;
|
|
||||||
}
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,13 +11,14 @@
|
|||||||
#include "catch_compiler_capabilities.h"
|
#include "catch_compiler_capabilities.h"
|
||||||
#include "catch_ptr.hpp"
|
#include "catch_ptr.hpp"
|
||||||
|
|
||||||
#include <map>
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iterator>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace TestCaseTracking {
|
namespace TestCaseTracking {
|
||||||
|
|
||||||
@@ -290,12 +291,12 @@ namespace TestCaseTracking {
|
|||||||
if( !filters.empty() ) {
|
if( !filters.empty() ) {
|
||||||
m_filters.push_back(""); // Root - should never be consulted
|
m_filters.push_back(""); // Root - should never be consulted
|
||||||
m_filters.push_back(""); // Test Case - not a section filter
|
m_filters.push_back(""); // Test Case - not a section filter
|
||||||
std::copy( filters.begin(), filters.end(), std::back_inserter( m_filters ) );
|
m_filters.insert( m_filters.end(), filters.begin(), filters.end() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void addNextFilters( std::vector<std::string> const& filters ) {
|
void addNextFilters( std::vector<std::string> const& filters ) {
|
||||||
if( filters.size() > 1 )
|
if( filters.size() > 1 )
|
||||||
std::copy( filters.begin()+1, filters.end(), std::back_inserter( m_filters ) );
|
m_filters.insert( m_filters.end(), ++filters.begin(), filters.end() );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -365,4 +366,6 @@ using TestCaseTracking::IndexTracker;
|
|||||||
|
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
|
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED
|
||||||
|
@@ -87,59 +87,76 @@ void registerTestCaseFunction
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
|
#define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
|
||||||
static void TestName(); \
|
static void TestName(); \
|
||||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); }\
|
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
||||||
|
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); } \
|
||||||
|
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
|
||||||
static void TestName()
|
static void TestName()
|
||||||
#define INTERNAL_CATCH_TESTCASE( ... ) \
|
#define INTERNAL_CATCH_TESTCASE( ... ) \
|
||||||
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
|
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
|
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
|
||||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); }
|
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
||||||
|
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); } \
|
||||||
|
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
|
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
|
||||||
|
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
||||||
namespace{ \
|
namespace{ \
|
||||||
struct TestName : ClassName{ \
|
struct TestName : ClassName{ \
|
||||||
void test(); \
|
void test(); \
|
||||||
}; \
|
}; \
|
||||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestName::test, #ClassName, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); \
|
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestName::test, #ClassName, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); \
|
||||||
} \
|
} \
|
||||||
|
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
|
||||||
void TestName::test()
|
void TestName::test()
|
||||||
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \
|
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \
|
||||||
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )
|
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
|
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
|
||||||
Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) );
|
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
||||||
|
Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); \
|
||||||
|
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
|
||||||
|
|
||||||
#else
|
#else
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_TESTCASE2( TestName, Name, Desc ) \
|
#define INTERNAL_CATCH_TESTCASE2( TestName, Name, Desc ) \
|
||||||
static void TestName(); \
|
static void TestName(); \
|
||||||
|
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
||||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); }\
|
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); }\
|
||||||
|
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
|
||||||
static void TestName()
|
static void TestName()
|
||||||
#define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
|
#define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
|
||||||
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), Name, Desc )
|
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), Name, Desc )
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \
|
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \
|
||||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( Name, Desc ), CATCH_INTERNAL_LINEINFO ); }
|
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
||||||
|
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( Name, Desc ), CATCH_INTERNAL_LINEINFO ); } \
|
||||||
|
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestCaseName, ClassName, TestName, Desc )\
|
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestCaseName, ClassName, TestName, Desc )\
|
||||||
|
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
||||||
namespace{ \
|
namespace{ \
|
||||||
struct TestCaseName : ClassName{ \
|
struct TestCaseName : ClassName{ \
|
||||||
void test(); \
|
void test(); \
|
||||||
}; \
|
}; \
|
||||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestCaseName::test, #ClassName, Catch::NameAndDesc( TestName, Desc ), CATCH_INTERNAL_LINEINFO ); \
|
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestCaseName::test, #ClassName, Catch::NameAndDesc( TestName, Desc ), CATCH_INTERNAL_LINEINFO ); \
|
||||||
} \
|
} \
|
||||||
|
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
|
||||||
void TestCaseName::test()
|
void TestCaseName::test()
|
||||||
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, TestName, Desc )\
|
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, TestName, Desc )\
|
||||||
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, TestName, Desc )
|
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, TestName, Desc )
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, Name, Desc ) \
|
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, Name, Desc ) \
|
||||||
Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) );
|
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
||||||
|
Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); \
|
||||||
|
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED
|
||||||
|
@@ -72,6 +72,7 @@ namespace Detail {
|
|||||||
|
|
||||||
extern const std::string unprintableString;
|
extern const std::string unprintableString;
|
||||||
|
|
||||||
|
#if !defined(CATCH_CONFIG_CPP11_STREAM_INSERTABLE_CHECK)
|
||||||
struct BorgType {
|
struct BorgType {
|
||||||
template<typename T> BorgType( T const& );
|
template<typename T> BorgType( T const& );
|
||||||
};
|
};
|
||||||
@@ -90,6 +91,20 @@ namespace Detail {
|
|||||||
static T const&t;
|
static T const&t;
|
||||||
enum { value = sizeof( testStreamable(s << t) ) == sizeof( TrueType ) };
|
enum { value = sizeof( testStreamable(s << t) ) == sizeof( TrueType ) };
|
||||||
};
|
};
|
||||||
|
#else
|
||||||
|
template<typename T>
|
||||||
|
class IsStreamInsertable {
|
||||||
|
template<typename SS, typename TT>
|
||||||
|
static auto test(int)
|
||||||
|
-> decltype( std::declval<SS&>() << std::declval<TT>(), std::true_type() );
|
||||||
|
|
||||||
|
template<typename, typename>
|
||||||
|
static auto test(...) -> std::false_type;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const bool value = decltype(test<std::ostream,const T&>(0))::value;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CATCH_CONFIG_CPP11_IS_ENUM)
|
#if defined(CATCH_CONFIG_CPP11_IS_ENUM)
|
||||||
template<typename T,
|
template<typename T,
|
||||||
|
@@ -15,7 +15,7 @@ namespace Catch {
|
|||||||
Version( unsigned int _majorVersion,
|
Version( unsigned int _majorVersion,
|
||||||
unsigned int _minorVersion,
|
unsigned int _minorVersion,
|
||||||
unsigned int _patchNumber,
|
unsigned int _patchNumber,
|
||||||
std::string const& _branchName,
|
char const * const _branchName,
|
||||||
unsigned int _buildNumber );
|
unsigned int _buildNumber );
|
||||||
|
|
||||||
unsigned int const majorVersion;
|
unsigned int const majorVersion;
|
||||||
@@ -23,7 +23,7 @@ namespace Catch {
|
|||||||
unsigned int const patchNumber;
|
unsigned int const patchNumber;
|
||||||
|
|
||||||
// buildNumber is only used if branchName is not null
|
// buildNumber is only used if branchName is not null
|
||||||
std::string const branchName;
|
char const * const branchName;
|
||||||
unsigned int const buildNumber;
|
unsigned int const buildNumber;
|
||||||
|
|
||||||
friend std::ostream& operator << ( std::ostream& os, Version const& version );
|
friend std::ostream& operator << ( std::ostream& os, Version const& version );
|
||||||
@@ -32,7 +32,7 @@ namespace Catch {
|
|||||||
void operator=( Version const& );
|
void operator=( Version const& );
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Version libraryVersion;
|
inline Version libraryVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_VERSION_H_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_VERSION_H_INCLUDED
|
||||||
|
@@ -16,7 +16,7 @@ namespace Catch {
|
|||||||
( unsigned int _majorVersion,
|
( unsigned int _majorVersion,
|
||||||
unsigned int _minorVersion,
|
unsigned int _minorVersion,
|
||||||
unsigned int _patchNumber,
|
unsigned int _patchNumber,
|
||||||
std::string const& _branchName,
|
char const * const _branchName,
|
||||||
unsigned int _buildNumber )
|
unsigned int _buildNumber )
|
||||||
: majorVersion( _majorVersion ),
|
: majorVersion( _majorVersion ),
|
||||||
minorVersion( _minorVersion ),
|
minorVersion( _minorVersion ),
|
||||||
@@ -29,15 +29,18 @@ namespace Catch {
|
|||||||
os << version.majorVersion << '.'
|
os << version.majorVersion << '.'
|
||||||
<< version.minorVersion << '.'
|
<< version.minorVersion << '.'
|
||||||
<< version.patchNumber;
|
<< version.patchNumber;
|
||||||
|
// branchName is never null -> 0th char is \0 if it is empty
|
||||||
if( !version.branchName.empty() ) {
|
if (version.branchName[0]) {
|
||||||
os << '-' << version.branchName
|
os << '-' << version.branchName
|
||||||
<< '.' << version.buildNumber;
|
<< '.' << version.buildNumber;
|
||||||
}
|
}
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version libraryVersion( 1, 8, 1, "", 0 );
|
inline Version libraryVersion() {
|
||||||
|
static Version version( 1, 9, 1, "", 0 );
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,12 +9,38 @@
|
|||||||
#define TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED
|
||||||
|
|
||||||
#include "../internal/catch_interfaces_reporter.h"
|
#include "../internal/catch_interfaces_reporter.h"
|
||||||
|
#include "../internal/catch_errno_guard.hpp"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cfloat>
|
||||||
|
#include <cstdio>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
// Because formatting using c++ streams is stateful, drop down to C is required
|
||||||
|
// Alternatively we could use stringstream, but its performance is... not good.
|
||||||
|
std::string getFormattedDuration( double duration ) {
|
||||||
|
// Max exponent + 1 is required to represent the whole part
|
||||||
|
// + 1 for decimal point
|
||||||
|
// + 3 for the 3 decimal places
|
||||||
|
// + 1 for null terminator
|
||||||
|
const size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;
|
||||||
|
char buffer[maxDoubleSize];
|
||||||
|
|
||||||
|
// Save previous errno, to prevent sprintf from overwriting it
|
||||||
|
ErrnoGuard guard;
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
sprintf_s(buffer, "%.3f", duration);
|
||||||
|
#else
|
||||||
|
sprintf(buffer, "%.3f", duration);
|
||||||
|
#endif
|
||||||
|
return std::string(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct StreamingReporterBase : SharedImpl<IStreamingReporter> {
|
struct StreamingReporterBase : SharedImpl<IStreamingReporter> {
|
||||||
|
|
||||||
StreamingReporterBase( ReporterConfig const& _config )
|
StreamingReporterBase( ReporterConfig const& _config )
|
||||||
|
@@ -37,8 +37,7 @@ namespace Catch {
|
|||||||
stream << "No test cases matched '" << spec << '\'' << std::endl;
|
stream << "No test cases matched '" << spec << '\'' << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void assertionStarting( AssertionInfo const& ) {
|
virtual void assertionStarting( AssertionInfo const& ) {}
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool assertionEnded( AssertionStats const& _assertionStats ) {
|
virtual bool assertionEnded( AssertionStats const& _assertionStats ) {
|
||||||
AssertionResult const& result = _assertionStats.assertionResult;
|
AssertionResult const& result = _assertionStats.assertionResult;
|
||||||
@@ -59,6 +58,12 @@ namespace Catch {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void sectionEnded(SectionStats const& _sectionStats) CATCH_OVERRIDE {
|
||||||
|
if (m_config->showDurations() == ShowDurations::Always) {
|
||||||
|
stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual void testRunEnded( TestRunStats const& _testRunStats ) {
|
virtual void testRunEnded( TestRunStats const& _testRunStats ) {
|
||||||
printTotals( _testRunStats.totals );
|
printTotals( _testRunStats.totals );
|
||||||
stream << '\n' << std::endl;
|
stream << '\n' << std::endl;
|
||||||
@@ -164,7 +169,7 @@ namespace Catch {
|
|||||||
stream << result.getSourceInfo() << ':';
|
stream << result.getSourceInfo() << ':';
|
||||||
}
|
}
|
||||||
|
|
||||||
void printResultType( Colour::Code colour, std::string passOrFail ) const {
|
void printResultType( Colour::Code colour, std::string const& passOrFail ) const {
|
||||||
if( !passOrFail.empty() ) {
|
if( !passOrFail.empty() ) {
|
||||||
{
|
{
|
||||||
Colour colourGuard( colour );
|
Colour colourGuard( colour );
|
||||||
@@ -174,7 +179,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printIssue( std::string issue ) const {
|
void printIssue( std::string const& issue ) const {
|
||||||
stream << ' ' << issue;
|
stream << ' ' << issue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,25 +18,6 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
namespace {
|
|
||||||
// Because formatting using c++ streams is stateful, drop down to C is required
|
|
||||||
// Alternatively we could use stringstream, but its performance is... not good.
|
|
||||||
std::string getFormattedDuration( double duration ) {
|
|
||||||
// Max exponent + 1 is required to represent the whole part
|
|
||||||
// + 1 for decimal point
|
|
||||||
// + 3 for the 3 decimal places
|
|
||||||
// + 1 for null terminator
|
|
||||||
const size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;
|
|
||||||
char buffer[maxDoubleSize];
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
sprintf_s(buffer, "%.3f", duration);
|
|
||||||
#else
|
|
||||||
sprintf(buffer, "%.3f", duration);
|
|
||||||
#endif
|
|
||||||
return std::string(buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct ConsoleReporter : StreamingReporterBase {
|
struct ConsoleReporter : StreamingReporterBase {
|
||||||
ConsoleReporter( ReporterConfig const& _config )
|
ConsoleReporter( ReporterConfig const& _config )
|
||||||
@@ -59,18 +40,15 @@ namespace Catch {
|
|||||||
virtual bool assertionEnded( AssertionStats const& _assertionStats ) CATCH_OVERRIDE {
|
virtual bool assertionEnded( AssertionStats const& _assertionStats ) CATCH_OVERRIDE {
|
||||||
AssertionResult const& result = _assertionStats.assertionResult;
|
AssertionResult const& result = _assertionStats.assertionResult;
|
||||||
|
|
||||||
bool printInfoMessages = true;
|
bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
|
||||||
|
|
||||||
// Drop out if result was successful and we're not printing those
|
// Drop out if result was successful but we're not printing them.
|
||||||
if( !m_config->includeSuccessfulResults() && result.isOk() ) {
|
if( !includeResults && result.getResultType() != ResultWas::Warning )
|
||||||
if( result.getResultType() != ResultWas::Warning )
|
return false;
|
||||||
return false;
|
|
||||||
printInfoMessages = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
lazyPrint();
|
lazyPrint();
|
||||||
|
|
||||||
AssertionPrinter printer( stream, _assertionStats, printInfoMessages );
|
AssertionPrinter printer( stream, _assertionStats, includeResults );
|
||||||
printer.print();
|
printer.print();
|
||||||
stream << std::endl;
|
stream << std::endl;
|
||||||
return true;
|
return true;
|
||||||
@@ -160,7 +138,11 @@ namespace Catch {
|
|||||||
case ResultWas::ThrewException:
|
case ResultWas::ThrewException:
|
||||||
colour = Colour::Error;
|
colour = Colour::Error;
|
||||||
passOrFail = "FAILED";
|
passOrFail = "FAILED";
|
||||||
messageLabel = "due to unexpected exception with message";
|
messageLabel = "due to unexpected exception with ";
|
||||||
|
if (_stats.infoMessages.size() == 1)
|
||||||
|
messageLabel += "message";
|
||||||
|
if (_stats.infoMessages.size() > 1)
|
||||||
|
messageLabel += "messages";
|
||||||
break;
|
break;
|
||||||
case ResultWas::FatalErrorCondition:
|
case ResultWas::FatalErrorCondition:
|
||||||
colour = Colour::Error;
|
colour = Colour::Error;
|
||||||
@@ -276,7 +258,7 @@ namespace Catch {
|
|||||||
stream << '\n' << getLineOfChars<'~'>() << '\n';
|
stream << '\n' << getLineOfChars<'~'>() << '\n';
|
||||||
Colour colour( Colour::SecondaryText );
|
Colour colour( Colour::SecondaryText );
|
||||||
stream << currentTestRunInfo->name
|
stream << currentTestRunInfo->name
|
||||||
<< " is a Catch v" << libraryVersion << " host application.\n"
|
<< " is a Catch v" << libraryVersion() << " host application.\n"
|
||||||
<< "Run with -? for options\n\n";
|
<< "Run with -? for options\n\n";
|
||||||
|
|
||||||
if( m_config->rngSeed() != 0 )
|
if( m_config->rngSeed() != 0 )
|
||||||
|
@@ -45,18 +45,9 @@ namespace Catch {
|
|||||||
virtual void assertionStarting( AssertionInfo const& ) {}
|
virtual void assertionStarting( AssertionInfo const& ) {}
|
||||||
|
|
||||||
virtual bool assertionEnded( AssertionStats const& _assertionStats ) {
|
virtual bool assertionEnded( AssertionStats const& _assertionStats ) {
|
||||||
AssertionResult const& result = _assertionStats.assertionResult;
|
++counter;
|
||||||
|
|
||||||
bool printInfoMessages = true;
|
AssertionPrinter printer( stream, _assertionStats, counter );
|
||||||
|
|
||||||
// Drop out if result was successful and we're not printing those
|
|
||||||
if ( !m_config->includeSuccessfulResults() && result.isOk() ) {
|
|
||||||
if ( result.getResultType() != ResultWas::Warning )
|
|
||||||
return false;
|
|
||||||
printInfoMessages = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
AssertionPrinter printer( stream, _assertionStats, printInfoMessages, ++counter );
|
|
||||||
printer.print();
|
printer.print();
|
||||||
stream << " # " << currentTestCaseInfo->name ;
|
stream << " # " << currentTestCaseInfo->name ;
|
||||||
|
|
||||||
@@ -75,13 +66,13 @@ namespace Catch {
|
|||||||
class AssertionPrinter {
|
class AssertionPrinter {
|
||||||
void operator= ( AssertionPrinter const& );
|
void operator= ( AssertionPrinter const& );
|
||||||
public:
|
public:
|
||||||
AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages, size_t counter = 0 )
|
AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, size_t counter )
|
||||||
: stream( _stream )
|
: stream( _stream )
|
||||||
, stats( _stats )
|
, stats( _stats )
|
||||||
, result( _stats.assertionResult )
|
, result( _stats.assertionResult )
|
||||||
, messages( _stats.infoMessages )
|
, messages( _stats.infoMessages )
|
||||||
, itMessage( _stats.infoMessages.begin() )
|
, itMessage( _stats.infoMessages.begin() )
|
||||||
, printInfoMessages( _printInfoMessages )
|
, printInfoMessages( true )
|
||||||
, counter(counter)
|
, counter(counter)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -156,28 +147,23 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static Colour::Code dimColour() { return Colour::FileName; }
|
static Colour::Code dimColour() { return Colour::FileName; }
|
||||||
|
|
||||||
static const char* failedString() { return "not ok"; }
|
static const char* failedString() { return "not ok"; }
|
||||||
static const char* passedString() { return "ok"; }
|
static const char* passedString() { return "ok"; }
|
||||||
|
|
||||||
void printSourceInfo() const {
|
void printSourceInfo() const {
|
||||||
Colour colourGuard( Colour::FileName );
|
Colour colourGuard( dimColour() );
|
||||||
stream << result.getSourceInfo() << ":";
|
stream << result.getSourceInfo() << ":";
|
||||||
}
|
}
|
||||||
|
|
||||||
void printResultType( std::string passOrFail ) const {
|
void printResultType( std::string const& passOrFail ) const {
|
||||||
if( !passOrFail.empty() ) {
|
if( !passOrFail.empty() ) {
|
||||||
{
|
stream << passOrFail << ' ' << counter << " -";
|
||||||
//Colour colourGuard( colour );
|
|
||||||
stream << passOrFail << " " << counter;
|
|
||||||
}
|
|
||||||
stream << " -";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printIssue( std::string issue ) const {
|
void printIssue( std::string const& issue ) const {
|
||||||
stream << " " << issue;
|
stream << " " << issue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,8 +204,9 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void printRemainingMessages( Colour::Code colour = dimColour() ) {
|
void printRemainingMessages( Colour::Code colour = dimColour() ) {
|
||||||
if ( itMessage == messages.end() )
|
if (itMessage == messages.end()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// using messages.end() directly yields compilation error:
|
// using messages.end() directly yields compilation error:
|
||||||
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
|
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
|
||||||
@@ -252,17 +239,6 @@ namespace Catch {
|
|||||||
size_t counter;
|
size_t counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Colour, message variants:
|
|
||||||
// - white: No tests ran.
|
|
||||||
// - red: Failed [both/all] N test cases, failed [both/all] M assertions.
|
|
||||||
// - white: Passed [both/all] N test cases (no assertions).
|
|
||||||
// - red: Failed N tests cases, failed M assertions.
|
|
||||||
// - green: Passed [both/all] N tests cases with M assertions.
|
|
||||||
|
|
||||||
std::string bothOrAll( std::size_t count ) const {
|
|
||||||
return count == 1 ? "" : count == 2 ? "both " : "all " ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void printTotals( const Totals& totals ) const {
|
void printTotals( const Totals& totals ) const {
|
||||||
if( totals.testCases.total() == 0 ) {
|
if( totals.testCases.total() == 0 ) {
|
||||||
stream << "1..0 # Skipped: No tests ran.";
|
stream << "1..0 # Skipped: No tests ran.";
|
||||||
|
@@ -49,14 +49,7 @@ namespace Catch {
|
|||||||
return "Reports test results as TeamCity service messages";
|
return "Reports test results as TeamCity service messages";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void skipTest( TestCaseInfo const& testInfo ) CATCH_OVERRIDE {
|
virtual void skipTest( TestCaseInfo const& /* testInfo */ ) CATCH_OVERRIDE {
|
||||||
stream << "##teamcity[testIgnored name='"
|
|
||||||
<< escape( testInfo.name ) << "'";
|
|
||||||
if( testInfo.isHidden() )
|
|
||||||
stream << " message='hidden test'";
|
|
||||||
else
|
|
||||||
stream << " message='test skipped because it didn|'t match the test spec'";
|
|
||||||
stream << "]\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void noMatchingTestCases( std::string const& /* spec */ ) CATCH_OVERRIDE {}
|
virtual void noMatchingTestCases( std::string const& /* spec */ ) CATCH_OVERRIDE {}
|
||||||
@@ -134,10 +127,19 @@ namespace Catch {
|
|||||||
" " << result.getExpandedExpression() << "\n";
|
" " << result.getExpandedExpression() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
stream << "##teamcity[testFailed"
|
if( currentTestCaseInfo->okToFail() ) {
|
||||||
<< " name='" << escape( currentTestCaseInfo->name )<< "'"
|
msg << "- failure ignore as test marked as 'ok to fail'\n";
|
||||||
<< " message='" << escape( msg.str() ) << "'"
|
stream << "##teamcity[testIgnored"
|
||||||
<< "]\n";
|
<< " name='" << escape( currentTestCaseInfo->name )<< "'"
|
||||||
|
<< " message='" << escape( msg.str() ) << "'"
|
||||||
|
<< "]\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stream << "##teamcity[testFailed"
|
||||||
|
<< " name='" << escape( currentTestCaseInfo->name )<< "'"
|
||||||
|
<< " message='" << escape( msg.str() ) << "'"
|
||||||
|
<< "]\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -203,7 +205,6 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
bool m_headerPrintedForThisSection;
|
bool m_headerPrintedForThisSection;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CATCH_IMPL
|
#ifdef CATCH_IMPL
|
||||||
|
@@ -92,73 +92,77 @@ namespace Catch {
|
|||||||
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE { }
|
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE { }
|
||||||
|
|
||||||
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE {
|
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE {
|
||||||
const AssertionResult& assertionResult = assertionStats.assertionResult;
|
|
||||||
|
|
||||||
// Print any info messages in <Info> tags.
|
AssertionResult const& result = assertionStats.assertionResult;
|
||||||
if( assertionStats.assertionResult.getResultType() != ResultWas::Ok ) {
|
|
||||||
|
bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
|
||||||
|
|
||||||
|
if( includeResults ) {
|
||||||
|
// Print any info messages in <Info> tags.
|
||||||
for( std::vector<MessageInfo>::const_iterator it = assertionStats.infoMessages.begin(), itEnd = assertionStats.infoMessages.end();
|
for( std::vector<MessageInfo>::const_iterator it = assertionStats.infoMessages.begin(), itEnd = assertionStats.infoMessages.end();
|
||||||
it != itEnd;
|
it != itEnd;
|
||||||
++it ) {
|
++it ) {
|
||||||
if( it->type == ResultWas::Info ) {
|
if( it->type == ResultWas::Info ) {
|
||||||
m_xml.scopedElement( "Info" )
|
m_xml.scopedElement( "Info" )
|
||||||
.writeText( it->message );
|
.writeText( it->message );
|
||||||
} else if ( it->type == ResultWas::Warning ) {
|
} else if ( it->type == ResultWas::Warning ) {
|
||||||
m_xml.scopedElement( "Warning" )
|
m_xml.scopedElement( "Warning" )
|
||||||
.writeText( it->message );
|
.writeText( it->message );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drop out if result was successful but we're not printing them.
|
// Drop out if result was successful but we're not printing them.
|
||||||
if( !m_config->includeSuccessfulResults() && isOk(assertionResult.getResultType()) )
|
if( !includeResults && result.getResultType() != ResultWas::Warning )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Print the expression if there is one.
|
|
||||||
if( assertionResult.hasExpression() ) {
|
|
||||||
m_xml.startElement( "Expression" )
|
|
||||||
.writeAttribute( "success", assertionResult.succeeded() )
|
|
||||||
.writeAttribute( "type", assertionResult.getTestMacroName() );
|
|
||||||
|
|
||||||
writeSourceInfo( assertionResult.getSourceInfo() );
|
// Print the expression if there is one.
|
||||||
|
if( result.hasExpression() ) {
|
||||||
|
m_xml.startElement( "Expression" )
|
||||||
|
.writeAttribute( "success", result.succeeded() )
|
||||||
|
.writeAttribute( "type", result.getTestMacroName() );
|
||||||
|
|
||||||
|
writeSourceInfo( result.getSourceInfo() );
|
||||||
|
|
||||||
m_xml.scopedElement( "Original" )
|
m_xml.scopedElement( "Original" )
|
||||||
.writeText( assertionResult.getExpression() );
|
.writeText( result.getExpression() );
|
||||||
m_xml.scopedElement( "Expanded" )
|
m_xml.scopedElement( "Expanded" )
|
||||||
.writeText( assertionResult.getExpandedExpression() );
|
.writeText( result.getExpandedExpression() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// And... Print a result applicable to each result type.
|
// And... Print a result applicable to each result type.
|
||||||
switch( assertionResult.getResultType() ) {
|
switch( result.getResultType() ) {
|
||||||
case ResultWas::ThrewException:
|
case ResultWas::ThrewException:
|
||||||
m_xml.startElement( "Exception" );
|
m_xml.startElement( "Exception" );
|
||||||
writeSourceInfo( assertionResult.getSourceInfo() );
|
writeSourceInfo( result.getSourceInfo() );
|
||||||
m_xml.writeText( assertionResult.getMessage() );
|
m_xml.writeText( result.getMessage() );
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
break;
|
break;
|
||||||
case ResultWas::FatalErrorCondition:
|
case ResultWas::FatalErrorCondition:
|
||||||
m_xml.startElement( "FatalErrorCondition" );
|
m_xml.startElement( "FatalErrorCondition" );
|
||||||
writeSourceInfo( assertionResult.getSourceInfo() );
|
writeSourceInfo( result.getSourceInfo() );
|
||||||
m_xml.writeText( assertionResult.getMessage() );
|
m_xml.writeText( result.getMessage() );
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
break;
|
break;
|
||||||
case ResultWas::Info:
|
case ResultWas::Info:
|
||||||
m_xml.scopedElement( "Info" )
|
m_xml.scopedElement( "Info" )
|
||||||
.writeText( assertionResult.getMessage() );
|
.writeText( result.getMessage() );
|
||||||
break;
|
break;
|
||||||
case ResultWas::Warning:
|
case ResultWas::Warning:
|
||||||
// Warning will already have been written
|
// Warning will already have been written
|
||||||
break;
|
break;
|
||||||
case ResultWas::ExplicitFailure:
|
case ResultWas::ExplicitFailure:
|
||||||
m_xml.startElement( "Failure" );
|
m_xml.startElement( "Failure" );
|
||||||
writeSourceInfo( assertionResult.getSourceInfo() );
|
writeSourceInfo( result.getSourceInfo() );
|
||||||
m_xml.writeText( assertionResult.getMessage() );
|
m_xml.writeText( result.getMessage() );
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( assertionResult.hasExpression() )
|
if( result.hasExpression() )
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -3,6 +3,30 @@
|
|||||||
<exe-name> is a <version> host application.
|
<exe-name> is a <version> host application.
|
||||||
Run with -? for options
|
Run with -? for options
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#748 - captures with unexpected exceptions
|
||||||
|
inside REQUIRE_NOTHROW
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
|
REQUIRE_NOTHROW( thisThrows() )
|
||||||
|
due to unexpected exception with messages:
|
||||||
|
answer := 42
|
||||||
|
expected exception
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#835 -- errno should not be touched by Catch
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( f() == 0 )
|
||||||
|
with expansion:
|
||||||
|
1 == 0
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
'Not' checks that should fail
|
'Not' checks that should fail
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -91,17 +115,6 @@ TrickyTests.cpp:<line number>: FAILED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
{?} == {?}
|
{?} == {?}
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
An unchecked exception reports the line of the last assertion
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
{Unknown expression after the reported line}
|
|
||||||
due to unexpected exception with message:
|
|
||||||
unexpected exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Contains string matcher
|
Contains string matcher
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -135,16 +148,6 @@ ExceptionTests.cpp:<line number>: FAILED:
|
|||||||
due to unexpected exception with message:
|
due to unexpected exception with message:
|
||||||
custom exception - not std
|
custom exception - not std
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Custom std-exceptions can be custom translated
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
due to unexpected exception with message:
|
|
||||||
custom std exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
EndsWith string matcher
|
EndsWith string matcher
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -276,6 +279,20 @@ MessageTests.cpp:<line number>
|
|||||||
|
|
||||||
MessageTests.cpp:<line number>: FAILED:
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
FAIL_CHECK does not abort the test
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MessageTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
|
explicitly with message:
|
||||||
|
This is a failure
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>:
|
||||||
|
warning:
|
||||||
|
This message appears in the output
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
INFO and WARN do not abort tests
|
INFO and WARN do not abort tests
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -396,16 +413,6 @@ MiscTests.cpp:<line number>:
|
|||||||
warning:
|
warning:
|
||||||
This one ran
|
This one ran
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Non-std exceptions can be translated
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
due to unexpected exception with message:
|
|
||||||
custom exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Ordering comparison checks that should fail
|
Ordering comparison checks that should fail
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -592,16 +599,6 @@ with expansion:
|
|||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Unexpected exceptions can be translated
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
due to unexpected exception with message:
|
|
||||||
3.14
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Vector matchers that fail
|
Vector matchers that fail
|
||||||
Contains (element)
|
Contains (element)
|
||||||
@@ -663,16 +660,6 @@ MatchersTests.cpp:<line number>: FAILED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
{ 1, 2, 3 } Equals: { }
|
{ 1, 2, 3 } Equals: { }
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
When unchecked exceptions are thrown directly they are always failures
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
due to unexpected exception with message:
|
|
||||||
unexpected exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
When unchecked exceptions are thrown during a CHECK the test should continue
|
When unchecked exceptions are thrown during a CHECK the test should continue
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -707,17 +694,6 @@ ExceptionTests.cpp:<line number>: FAILED:
|
|||||||
due to unexpected exception with message:
|
due to unexpected exception with message:
|
||||||
expected exception
|
expected exception
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
When unchecked exceptions are thrown from sections they are always failures
|
|
||||||
section name
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
due to unexpected exception with message:
|
|
||||||
unexpected exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Where the LHS is not a simple value
|
Where the LHS is not a simple value
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -890,6 +866,6 @@ with expansion:
|
|||||||
"first" == "second"
|
"first" == "second"
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 163 | 118 passed | 43 failed | 2 failed as expected
|
test cases: 167 | 125 passed | 38 failed | 4 failed as expected
|
||||||
assertions: 953 | 849 passed | 86 failed | 18 failed as expected
|
assertions: 960 | 859 passed | 81 failed | 20 failed as expected
|
||||||
|
|
||||||
|
@@ -15,26 +15,30 @@ with message:
|
|||||||
yay
|
yay
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
#542
|
#748 - captures with unexpected exceptions
|
||||||
|
inside REQUIRE_NOTHROW
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
CompilationTests.cpp:<line number>
|
ExceptionTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
|
||||||
CompilationTests.cpp:<line number>:
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
PASSED:
|
REQUIRE_NOTHROW( thisThrows() )
|
||||||
CHECK_THROWS_AS( throws_int(true), int )
|
due to unexpected exception with messages:
|
||||||
|
answer := 42
|
||||||
|
expected exception
|
||||||
|
|
||||||
CompilationTests.cpp:<line number>:
|
-------------------------------------------------------------------------------
|
||||||
PASSED:
|
#748 - captures with unexpected exceptions
|
||||||
CHECK_THROWS_AS( throws_int(true), int& )
|
inside REQUIRE_THROWS
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
CompilationTests.cpp:<line number>:
|
ExceptionTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
CHECK_THROWS_AS( throws_int(true), const int )
|
REQUIRE_THROWS( thisThrows() )
|
||||||
|
with message:
|
||||||
CompilationTests.cpp:<line number>:
|
answer := 42
|
||||||
PASSED:
|
|
||||||
CHECK_THROWS_AS( throws_int(true), const int& )
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
#809
|
#809
|
||||||
@@ -48,6 +52,65 @@ PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
42 == {?}
|
42 == {?}
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#833
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
CompilationTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE( a == t )
|
||||||
|
with expansion:
|
||||||
|
3 == 3
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( a == t )
|
||||||
|
with expansion:
|
||||||
|
3 == 3
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE_THROWS( throws_int(true) )
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK_THROWS_AS( throws_int(true), const int& )
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE_NOTHROW( throws_int(false) )
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE_THAT( "aaa", Catch::EndsWith("aaa") )
|
||||||
|
with expansion:
|
||||||
|
"aaa" ends with: "aaa"
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE( templated_tests<int>(3) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#835 -- errno should not be touched by Catch
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( f() == 0 )
|
||||||
|
with expansion:
|
||||||
|
1 == 0
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE( (*__error()) == 1 )
|
||||||
|
with expansion:
|
||||||
|
1 == 1
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
'Not' checks that should fail
|
'Not' checks that should fail
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -381,11 +444,6 @@ ExceptionTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
CHECK( 1 == 1 )
|
CHECK( 1 == 1 )
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
{Unknown expression after the reported line}
|
|
||||||
due to unexpected exception with message:
|
|
||||||
unexpected exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Anonymous test case 1
|
Anonymous test case 1
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -603,6 +661,32 @@ PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
true
|
true
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Capture and info messages
|
||||||
|
Capture should stringify like assertions
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ToStringGeneralTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ToStringGeneralTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE( true )
|
||||||
|
with message:
|
||||||
|
i := 2
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Capture and info messages
|
||||||
|
Info should NOT stringify the way assertions do
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ToStringGeneralTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
ToStringGeneralTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE( true )
|
||||||
|
with message:
|
||||||
|
3
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Character pretty printing
|
Character pretty printing
|
||||||
Specifically escaped
|
Specifically escaped
|
||||||
@@ -914,16 +998,6 @@ ExceptionTests.cpp:<line number>: FAILED:
|
|||||||
due to unexpected exception with message:
|
due to unexpected exception with message:
|
||||||
custom exception - not std
|
custom exception - not std
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Custom std-exceptions can be custom translated
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
due to unexpected exception with message:
|
|
||||||
custom std exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Demonstrate that a non-const == is not used
|
Demonstrate that a non-const == is not used
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -1173,6 +1247,20 @@ MessageTests.cpp:<line number>
|
|||||||
|
|
||||||
MessageTests.cpp:<line number>: FAILED:
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
FAIL_CHECK does not abort the test
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MessageTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>: FAILED:
|
||||||
|
explicitly with message:
|
||||||
|
This is a failure
|
||||||
|
|
||||||
|
MessageTests.cpp:<line number>:
|
||||||
|
warning:
|
||||||
|
This message appears in the output
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Factorials are computed
|
Factorials are computed
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -3292,7 +3380,7 @@ with expansion:
|
|||||||
re>"
|
re>"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Long text is truncted
|
Long text is truncated
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
TestMain.cpp:<line number>
|
TestMain.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@@ -4420,16 +4508,6 @@ MiscTests.cpp:<line number>:
|
|||||||
warning:
|
warning:
|
||||||
This one ran
|
This one ran
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Non-std exceptions can be translated
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
due to unexpected exception with message:
|
|
||||||
custom exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
NotImplemented exception
|
NotImplemented exception
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -5814,6 +5892,23 @@ MessageTests.cpp:<line number>:
|
|||||||
warning:
|
warning:
|
||||||
toString(p): 0x<hex digits>
|
toString(p): 0x<hex digits>
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Process can be configured on command line
|
||||||
|
empty args don't cause a crash
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
TestMain.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
TestMain.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK_NOTHROW( parser.parseInto( std::vector<std::string>(), config ) )
|
||||||
|
|
||||||
|
TestMain.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( config.processName == "" )
|
||||||
|
with expansion:
|
||||||
|
"" == ""
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Process can be configured on command line
|
Process can be configured on command line
|
||||||
default - no arguments
|
default - no arguments
|
||||||
@@ -5825,6 +5920,12 @@ TestMain.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) )
|
CHECK_NOTHROW( parseIntoConfig( argv, config ) )
|
||||||
|
|
||||||
|
TestMain.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( config.processName == "test" )
|
||||||
|
with expansion:
|
||||||
|
"test" == "test"
|
||||||
|
|
||||||
TestMain.cpp:<line number>:
|
TestMain.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
CHECK( config.shouldDebugBreak == false )
|
CHECK( config.shouldDebugBreak == false )
|
||||||
@@ -6727,7 +6828,8 @@ PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
"error: tag alias, "[@zzz]" already registered.
|
"error: tag alias, "[@zzz]" already registered.
|
||||||
First seen at file:2
|
First seen at file:2
|
||||||
Redefined at file:10" contains: "[@zzz]"
|
Redefined at file:10
|
||||||
|
" contains: "[@zzz]"
|
||||||
|
|
||||||
TagAliasTests.cpp:<line number>:
|
TagAliasTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
@@ -6735,7 +6837,8 @@ PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
"error: tag alias, "[@zzz]" already registered.
|
"error: tag alias, "[@zzz]" already registered.
|
||||||
First seen at file:2
|
First seen at file:2
|
||||||
Redefined at file:10" contains: "file"
|
Redefined at file:10
|
||||||
|
" contains: "file"
|
||||||
|
|
||||||
TagAliasTests.cpp:<line number>:
|
TagAliasTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
@@ -6743,7 +6846,8 @@ PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
"error: tag alias, "[@zzz]" already registered.
|
"error: tag alias, "[@zzz]" already registered.
|
||||||
First seen at file:2
|
First seen at file:2
|
||||||
Redefined at file:10" contains: "2"
|
Redefined at file:10
|
||||||
|
" contains: "2"
|
||||||
|
|
||||||
TagAliasTests.cpp:<line number>:
|
TagAliasTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
@@ -6751,7 +6855,8 @@ PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
"error: tag alias, "[@zzz]" already registered.
|
"error: tag alias, "[@zzz]" already registered.
|
||||||
First seen at file:2
|
First seen at file:2
|
||||||
Redefined at file:10" contains: "10"
|
Redefined at file:10
|
||||||
|
" contains: "10"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Tag alias can be registered against tag patterns
|
Tag alias can be registered against tag patterns
|
||||||
@@ -7840,16 +7945,6 @@ PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
true
|
true
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Unexpected exceptions can be translated
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
due to unexpected exception with message:
|
|
||||||
3.14
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Use a custom approx
|
Use a custom approx
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -8070,16 +8165,6 @@ ExceptionTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE_THROWS( thisThrows() )
|
REQUIRE_THROWS( thisThrows() )
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
When unchecked exceptions are thrown directly they are always failures
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
due to unexpected exception with message:
|
|
||||||
unexpected exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
When unchecked exceptions are thrown during a CHECK the test should continue
|
When unchecked exceptions are thrown during a CHECK the test should continue
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -8114,17 +8199,6 @@ ExceptionTests.cpp:<line number>: FAILED:
|
|||||||
due to unexpected exception with message:
|
due to unexpected exception with message:
|
||||||
expected exception
|
expected exception
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
When unchecked exceptions are thrown from sections they are always failures
|
|
||||||
section name
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
...............................................................................
|
|
||||||
|
|
||||||
ExceptionTests.cpp:<line number>: FAILED:
|
|
||||||
due to unexpected exception with message:
|
|
||||||
unexpected exception
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Where the LHS is not a simple value
|
Where the LHS is not a simple value
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -9324,6 +9398,6 @@ MiscTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 163 | 117 passed | 44 failed | 2 failed as expected
|
test cases: 167 | 124 passed | 39 failed | 4 failed as expected
|
||||||
assertions: 955 | 849 passed | 88 failed | 18 failed as expected
|
assertions: 962 | 859 passed | 83 failed | 20 failed as expected
|
||||||
|
|
||||||
|
@@ -15,26 +15,30 @@ with message:
|
|||||||
yay
|
yay
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
#542
|
#748 - captures with unexpected exceptions
|
||||||
|
inside REQUIRE_NOTHROW
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
CompilationTests.cpp:<line number>
|
ExceptionTests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
|
||||||
CompilationTests.cpp:<line number>:
|
ExceptionTests.cpp:<line number>: FAILED:
|
||||||
PASSED:
|
REQUIRE_NOTHROW( thisThrows() )
|
||||||
CHECK_THROWS_AS( throws_int(true), int )
|
due to unexpected exception with messages:
|
||||||
|
answer := 42
|
||||||
|
expected exception
|
||||||
|
|
||||||
CompilationTests.cpp:<line number>:
|
-------------------------------------------------------------------------------
|
||||||
PASSED:
|
#748 - captures with unexpected exceptions
|
||||||
CHECK_THROWS_AS( throws_int(true), int& )
|
inside REQUIRE_THROWS
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
CompilationTests.cpp:<line number>:
|
ExceptionTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
CHECK_THROWS_AS( throws_int(true), const int )
|
REQUIRE_THROWS( thisThrows() )
|
||||||
|
with message:
|
||||||
CompilationTests.cpp:<line number>:
|
answer := 42
|
||||||
PASSED:
|
|
||||||
CHECK_THROWS_AS( throws_int(true), const int& )
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
#809
|
#809
|
||||||
@@ -48,6 +52,65 @@ PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
42 == {?}
|
42 == {?}
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#833
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
CompilationTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE( a == t )
|
||||||
|
with expansion:
|
||||||
|
3 == 3
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( a == t )
|
||||||
|
with expansion:
|
||||||
|
3 == 3
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE_THROWS( throws_int(true) )
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK_THROWS_AS( throws_int(true), const int& )
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE_NOTHROW( throws_int(false) )
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE_THAT( "aaa", Catch::EndsWith("aaa") )
|
||||||
|
with expansion:
|
||||||
|
"aaa" ends with: "aaa"
|
||||||
|
|
||||||
|
CompilationTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE( templated_tests<int>(3) )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#835 -- errno should not be touched by Catch
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( f() == 0 )
|
||||||
|
with expansion:
|
||||||
|
1 == 0
|
||||||
|
|
||||||
|
MiscTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
REQUIRE( (*__error()) == 1 )
|
||||||
|
with expansion:
|
||||||
|
1 == 1
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
'Not' checks that should fail
|
'Not' checks that should fail
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -69,6 +132,6 @@ ConditionTests.cpp:<line number>: FAILED:
|
|||||||
CHECK_FALSE( true )
|
CHECK_FALSE( true )
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 4 | 3 passed | 1 failed
|
test cases: 6 | 3 passed | 1 failed | 2 failed as expected
|
||||||
assertions: 10 | 6 passed | 4 failed
|
assertions: 17 | 11 passed | 4 failed | 2 failed as expected
|
||||||
|
|
||||||
|
@@ -1,9 +1,22 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<testsuitesspanner>
|
<testsuitesspanner>
|
||||||
<testsuite name="<exe-name>" errors="13" failures="76" tests="956" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
<testsuite name="<exe-name>" errors="8" failures="76" tests="963" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||||
<testcase classname="global" name="# A test name that starts with a #" time="{duration}"/>
|
<testcase classname="global" name="# A test name that starts with a #" time="{duration}"/>
|
||||||
<testcase classname="global" name="#542" time="{duration}"/>
|
<testcase classname="#748 - captures with unexpected exceptions" name="inside REQUIRE_NOTHROW" time="{duration}">
|
||||||
|
<error message="thisThrows()" type="REQUIRE_NOTHROW">
|
||||||
|
expected exception
|
||||||
|
answer := 42
|
||||||
|
ExceptionTests.cpp:<line number>
|
||||||
|
</error>
|
||||||
|
</testcase>
|
||||||
|
<testcase classname="#748 - captures with unexpected exceptions" name="inside REQUIRE_THROWS" time="{duration}"/>
|
||||||
<testcase classname="global" name="#809" time="{duration}"/>
|
<testcase classname="global" name="#809" time="{duration}"/>
|
||||||
|
<testcase classname="global" name="#833" time="{duration}"/>
|
||||||
|
<testcase classname="global" name="#835 -- errno should not be touched by Catch" time="{duration}">
|
||||||
|
<failure message="1 == 0" type="CHECK">
|
||||||
|
MiscTests.cpp:<line number>
|
||||||
|
</failure>
|
||||||
|
</testcase>
|
||||||
<testcase classname="global" name="'Not' checks that should fail" time="{duration}">
|
<testcase classname="global" name="'Not' checks that should fail" time="{duration}">
|
||||||
<failure message="false != false" type="CHECK">
|
<failure message="false != false" type="CHECK">
|
||||||
ConditionTests.cpp:<line number>
|
ConditionTests.cpp:<line number>
|
||||||
@@ -66,12 +79,7 @@ TrickyTests.cpp:<line number>
|
|||||||
<testcase classname="global" name="Absolute margin" time="{duration}"/>
|
<testcase classname="global" name="Absolute margin" time="{duration}"/>
|
||||||
<testcase classname="global" name="AllOf matcher" time="{duration}"/>
|
<testcase classname="global" name="AllOf matcher" time="{duration}"/>
|
||||||
<testcase classname="global" name="An expression with side-effects should only be evaluated once" time="{duration}"/>
|
<testcase classname="global" name="An expression with side-effects should only be evaluated once" time="{duration}"/>
|
||||||
<testcase classname="global" name="An unchecked exception reports the line of the last assertion" time="{duration}">
|
<testcase classname="global" name="An unchecked exception reports the line of the last assertion" time="{duration}"/>
|
||||||
<error message="{Unknown expression after the reported line}">
|
|
||||||
unexpected exception
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
</error>
|
|
||||||
</testcase>
|
|
||||||
<testcase classname="global" name="Anonymous test case 1" time="{duration}"/>
|
<testcase classname="global" name="Anonymous test case 1" time="{duration}"/>
|
||||||
<testcase classname="global" name="AnyOf matcher" time="{duration}"/>
|
<testcase classname="global" name="AnyOf matcher" time="{duration}"/>
|
||||||
<testcase classname="global" name="Approximate PI" time="{duration}"/>
|
<testcase classname="global" name="Approximate PI" time="{duration}"/>
|
||||||
@@ -83,6 +91,8 @@ ExceptionTests.cpp:<line number>
|
|||||||
<testcase classname="Assertions then sections" name="A section" time="{duration}"/>
|
<testcase classname="Assertions then sections" name="A section" time="{duration}"/>
|
||||||
<testcase classname="Assertions then sections" name="A section/Another section" time="{duration}"/>
|
<testcase classname="Assertions then sections" name="A section/Another section" time="{duration}"/>
|
||||||
<testcase classname="Assertions then sections" name="A section/Another other section" time="{duration}"/>
|
<testcase classname="Assertions then sections" name="A section/Another other section" time="{duration}"/>
|
||||||
|
<testcase classname="Capture and info messages" name="Capture should stringify like assertions" time="{duration}"/>
|
||||||
|
<testcase classname="Capture and info messages" name="Info should NOT stringify the way assertions do" time="{duration}"/>
|
||||||
<testcase classname="Character pretty printing" name="Specifically escaped" time="{duration}"/>
|
<testcase classname="Character pretty printing" name="Specifically escaped" time="{duration}"/>
|
||||||
<testcase classname="Character pretty printing" name="General chars" time="{duration}"/>
|
<testcase classname="Character pretty printing" name="General chars" time="{duration}"/>
|
||||||
<testcase classname="Character pretty printing" name="Low ASCII" time="{duration}"/>
|
<testcase classname="Character pretty printing" name="Low ASCII" time="{duration}"/>
|
||||||
@@ -105,12 +115,6 @@ ExceptionTests.cpp:<line number>
|
|||||||
<testcase classname="global" name="Custom exceptions can be translated when testing for throwing as something else" time="{duration}">
|
<testcase classname="global" name="Custom exceptions can be translated when testing for throwing as something else" time="{duration}">
|
||||||
<error message="throwCustom(), std::exception" type="REQUIRE_THROWS_AS">
|
<error message="throwCustom(), std::exception" type="REQUIRE_THROWS_AS">
|
||||||
custom exception - not std
|
custom exception - not std
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
</error>
|
|
||||||
</testcase>
|
|
||||||
<testcase classname="global" name="Custom std-exceptions can be custom translated" time="{duration}">
|
|
||||||
<error type="TEST_CASE">
|
|
||||||
custom std exception
|
|
||||||
ExceptionTests.cpp:<line number>
|
ExceptionTests.cpp:<line number>
|
||||||
</error>
|
</error>
|
||||||
</testcase>
|
</testcase>
|
||||||
@@ -192,6 +196,12 @@ MessageTests.cpp:<line number>
|
|||||||
</testcase>
|
</testcase>
|
||||||
<testcase classname="global" name="FAIL does not require an argument" time="{duration}">
|
<testcase classname="global" name="FAIL does not require an argument" time="{duration}">
|
||||||
<failure type="FAIL">
|
<failure type="FAIL">
|
||||||
|
MessageTests.cpp:<line number>
|
||||||
|
</failure>
|
||||||
|
</testcase>
|
||||||
|
<testcase classname="global" name="FAIL_CHECK does not abort the test" time="{duration}">
|
||||||
|
<failure type="FAIL_CHECK">
|
||||||
|
This is a failure
|
||||||
MessageTests.cpp:<line number>
|
MessageTests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
@@ -250,7 +260,7 @@ ConditionTests.cpp:<line number>
|
|||||||
<testcase classname="Long strings can be wrapped" name="With wrap-before/ after characters/No wrapping" time="{duration}"/>
|
<testcase classname="Long strings can be wrapped" name="With wrap-before/ after characters/No wrapping" time="{duration}"/>
|
||||||
<testcase classname="Long strings can be wrapped" name="With wrap-before/ after characters/Wrap before" time="{duration}"/>
|
<testcase classname="Long strings can be wrapped" name="With wrap-before/ after characters/Wrap before" time="{duration}"/>
|
||||||
<testcase classname="Long strings can be wrapped" name="With wrap-before/ after characters/Wrap after" time="{duration}"/>
|
<testcase classname="Long strings can be wrapped" name="With wrap-before/ after characters/Wrap after" time="{duration}"/>
|
||||||
<testcase classname="global" name="Long text is truncted" time="{duration}"/>
|
<testcase classname="global" name="Long text is truncated" time="{duration}"/>
|
||||||
<testcase classname="global" name="ManuallyRegistered" time="{duration}"/>
|
<testcase classname="global" name="ManuallyRegistered" time="{duration}"/>
|
||||||
<testcase classname="global" name="Matchers can be (AllOf) composed with the && operator" time="{duration}"/>
|
<testcase classname="global" name="Matchers can be (AllOf) composed with the && operator" time="{duration}"/>
|
||||||
<testcase classname="global" name="Matchers can be (AnyOf) composed with the || operator" time="{duration}"/>
|
<testcase classname="global" name="Matchers can be (AnyOf) composed with the || operator" time="{duration}"/>
|
||||||
@@ -272,12 +282,6 @@ ExceptionTests.cpp:<line number>
|
|||||||
</failure>
|
</failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase classname="global" name="Nice descriptive name" time="{duration}"/>
|
<testcase classname="global" name="Nice descriptive name" time="{duration}"/>
|
||||||
<testcase classname="global" name="Non-std exceptions can be translated" time="{duration}">
|
|
||||||
<error type="TEST_CASE">
|
|
||||||
custom exception
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
</error>
|
|
||||||
</testcase>
|
|
||||||
<testcase classname="global" name="NotImplemented exception" time="{duration}"/>
|
<testcase classname="global" name="NotImplemented exception" time="{duration}"/>
|
||||||
<testcase classname="global" name="Objects that evaluated in boolean contexts can be checked" time="{duration}"/>
|
<testcase classname="global" name="Objects that evaluated in boolean contexts can be checked" time="{duration}"/>
|
||||||
<testcase classname="global" name="Operators at different namespace levels not hijacked by Koenig lookup" time="{duration}"/>
|
<testcase classname="global" name="Operators at different namespace levels not hijacked by Koenig lookup" time="{duration}"/>
|
||||||
@@ -387,6 +391,7 @@ MessageTests.cpp:<line number>
|
|||||||
<testcase classname="global" name="Parsing a std::pair" time="{duration}"/>
|
<testcase classname="global" name="Parsing a std::pair" time="{duration}"/>
|
||||||
<testcase classname="global" name="Pointers can be compared to null" time="{duration}"/>
|
<testcase classname="global" name="Pointers can be compared to null" time="{duration}"/>
|
||||||
<testcase classname="global" name="Pointers can be converted to strings" time="{duration}"/>
|
<testcase classname="global" name="Pointers can be converted to strings" time="{duration}"/>
|
||||||
|
<testcase classname="Process can be configured on command line" name="empty args don't cause a crash" time="{duration}"/>
|
||||||
<testcase classname="Process can be configured on command line" name="default - no arguments" time="{duration}"/>
|
<testcase classname="Process can be configured on command line" name="default - no arguments" time="{duration}"/>
|
||||||
<testcase classname="Process can be configured on command line" name="test lists/1 test" time="{duration}"/>
|
<testcase classname="Process can be configured on command line" name="test lists/1 test" time="{duration}"/>
|
||||||
<testcase classname="Process can be configured on command line" name="test lists/Specify one test case exclusion using exclude:" time="{duration}"/>
|
<testcase classname="Process can be configured on command line" name="test lists/Specify one test case exclusion using exclude:" time="{duration}"/>
|
||||||
@@ -492,12 +497,6 @@ MiscTests.cpp:<line number>
|
|||||||
<testcase classname="Tracker" name="start a generator/Start a new inner section/Re-enter for second generation" time="{duration}"/>
|
<testcase classname="Tracker" name="start a generator/Start a new inner section/Re-enter for second generation" time="{duration}"/>
|
||||||
<testcase classname="Tracker" name="start a generator/Fail an inner section" time="{duration}"/>
|
<testcase classname="Tracker" name="start a generator/Fail an inner section" time="{duration}"/>
|
||||||
<testcase classname="Tracker" name="start a generator/Fail an inner section/Re-enter for second generation" time="{duration}"/>
|
<testcase classname="Tracker" name="start a generator/Fail an inner section/Re-enter for second generation" time="{duration}"/>
|
||||||
<testcase classname="global" name="Unexpected exceptions can be translated" time="{duration}">
|
|
||||||
<error type="TEST_CASE">
|
|
||||||
3.14
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
</error>
|
|
||||||
</testcase>
|
|
||||||
<testcase classname="global" name="Use a custom approx" time="{duration}"/>
|
<testcase classname="global" name="Use a custom approx" time="{duration}"/>
|
||||||
<testcase classname="Variadic macros" name="Section with one argument" time="{duration}"/>
|
<testcase classname="Variadic macros" name="Section with one argument" time="{duration}"/>
|
||||||
<testcase classname="Vector matchers" name="Contains (element)" time="{duration}"/>
|
<testcase classname="Vector matchers" name="Contains (element)" time="{duration}"/>
|
||||||
@@ -534,12 +533,6 @@ MatchersTests.cpp:<line number>
|
|||||||
</failure>
|
</failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase classname="global" name="When checked exceptions are thrown they can be expected or unexpected" time="{duration}"/>
|
<testcase classname="global" name="When checked exceptions are thrown they can be expected or unexpected" time="{duration}"/>
|
||||||
<testcase classname="global" name="When unchecked exceptions are thrown directly they are always failures" time="{duration}">
|
|
||||||
<error type="TEST_CASE">
|
|
||||||
unexpected exception
|
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
</error>
|
|
||||||
</testcase>
|
|
||||||
<testcase classname="global" name="When unchecked exceptions are thrown during a CHECK the test should continue" time="{duration}">
|
<testcase classname="global" name="When unchecked exceptions are thrown during a CHECK the test should continue" time="{duration}">
|
||||||
<error message="thisThrows() == 0" type="CHECK">
|
<error message="thisThrows() == 0" type="CHECK">
|
||||||
expected exception
|
expected exception
|
||||||
@@ -555,12 +548,6 @@ ExceptionTests.cpp:<line number>
|
|||||||
<testcase classname="global" name="When unchecked exceptions are thrown from functions they are always failures" time="{duration}">
|
<testcase classname="global" name="When unchecked exceptions are thrown from functions they are always failures" time="{duration}">
|
||||||
<error message="thisThrows() == 0" type="CHECK">
|
<error message="thisThrows() == 0" type="CHECK">
|
||||||
expected exception
|
expected exception
|
||||||
ExceptionTests.cpp:<line number>
|
|
||||||
</error>
|
|
||||||
</testcase>
|
|
||||||
<testcase classname="When unchecked exceptions are thrown from sections they are always failures" name="section name" time="{duration}">
|
|
||||||
<error type="TEST_CASE">
|
|
||||||
unexpected exception
|
|
||||||
ExceptionTests.cpp:<line number>
|
ExceptionTests.cpp:<line number>
|
||||||
</error>
|
</error>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
@@ -4,39 +4,41 @@
|
|||||||
<TestCase name="# A test name that starts with a #" filename="projects/<exe-name>/MiscTests.cpp" >
|
<TestCase name="# A test name that starts with a #" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="#542" filename="projects/<exe-name>/CompilationTests.cpp" >
|
<TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Expression success="true" type="CHECK_THROWS_AS" filename="projects/<exe-name>/CompilationTests.cpp" >
|
<Section name="outside assertions" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Original>
|
<OverallResults successes="0" failures="0" expectedFailures="0"/>
|
||||||
throws_int(true), int
|
</Section>
|
||||||
</Original>
|
<Section name="inside REQUIRE_NOTHROW" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Expanded>
|
<Info>
|
||||||
throws_int(true), int
|
answer := 42
|
||||||
</Expanded>
|
</Info>
|
||||||
</Expression>
|
<Expression success="false" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Expression success="true" type="CHECK_THROWS_AS" filename="projects/<exe-name>/CompilationTests.cpp" >
|
<Original>
|
||||||
<Original>
|
thisThrows()
|
||||||
throws_int(true), int&
|
</Original>
|
||||||
</Original>
|
<Expanded>
|
||||||
<Expanded>
|
thisThrows()
|
||||||
throws_int(true), int&
|
</Expanded>
|
||||||
</Expanded>
|
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
</Expression>
|
expected exception
|
||||||
<Expression success="true" type="CHECK_THROWS_AS" filename="projects/<exe-name>/CompilationTests.cpp" >
|
</Exception>
|
||||||
<Original>
|
</Expression>
|
||||||
throws_int(true), const int
|
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
||||||
</Original>
|
</Section>
|
||||||
<Expanded>
|
<Section name="inside REQUIRE_THROWS" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
throws_int(true), const int
|
<Info>
|
||||||
</Expanded>
|
answer := 42
|
||||||
</Expression>
|
</Info>
|
||||||
<Expression success="true" type="CHECK_THROWS_AS" filename="projects/<exe-name>/CompilationTests.cpp" >
|
<Expression success="true" type="REQUIRE_THROWS" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
throws_int(true), const int&
|
thisThrows()
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
throws_int(true), const int&
|
thisThrows()
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="#809" filename="projects/<exe-name>/CompilationTests.cpp" >
|
<TestCase name="#809" filename="projects/<exe-name>/CompilationTests.cpp" >
|
||||||
@@ -50,6 +52,84 @@
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
|
<TestCase name="#833" filename="projects/<exe-name>/CompilationTests.cpp" >
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/CompilationTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
a == t
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
3 == 3
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/CompilationTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
a == t
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
3 == 3
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE_THROWS" filename="projects/<exe-name>/CompilationTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
throws_int(true)
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
throws_int(true)
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="CHECK_THROWS_AS" filename="projects/<exe-name>/CompilationTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
throws_int(true), const int&
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
throws_int(true), const int&
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/CompilationTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
throws_int(false)
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
throws_int(false)
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/CompilationTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
"aaa", Catch::EndsWith("aaa")
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
"aaa" ends with: "aaa"
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/CompilationTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
templated_tests<int>(3)
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResult success="true"/>
|
||||||
|
</TestCase>
|
||||||
|
<TestCase name="#835 -- errno should not be touched by Catch" tags="[!shouldfail]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||||
|
<Expression success="false" type="CHECK" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
f() == 0
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
1 == 0
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
(*__error()) == 1
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
1 == 1
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResult success="true"/>
|
||||||
|
</TestCase>
|
||||||
<TestCase name="'Not' checks that should fail" tags="[.][failing][hide]" filename="projects/<exe-name>/ConditionTests.cpp" >
|
<TestCase name="'Not' checks that should fail" tags="[.][failing][hide]" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/ConditionTests.cpp" >
|
<Expression success="false" type="CHECK" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
@@ -426,18 +506,7 @@
|
|||||||
1 == 1
|
1 == 1
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="false" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<OverallResult success="true"/>
|
||||||
<Original>
|
|
||||||
{Unknown expression after the reported line}
|
|
||||||
</Original>
|
|
||||||
<Expanded>
|
|
||||||
{Unknown expression after the reported line}
|
|
||||||
</Expanded>
|
|
||||||
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
|
||||||
unexpected exception
|
|
||||||
</Exception>
|
|
||||||
</Expression>
|
|
||||||
<OverallResult success="false"/>
|
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Anonymous test case 1" filename="projects/<exe-name>/VariadicMacrosTests.cpp" >
|
<TestCase name="Anonymous test case 1" filename="projects/<exe-name>/VariadicMacrosTests.cpp" >
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
@@ -643,6 +712,37 @@
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
|
<TestCase name="Capture and info messages" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
|
||||||
|
<Section name="Capture should stringify like assertions" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
|
||||||
|
<Info>
|
||||||
|
i := 2
|
||||||
|
</Info>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
true
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<Section name="Info should NOT stringify the way assertions do" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
|
||||||
|
<Info>
|
||||||
|
3
|
||||||
|
</Info>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
true
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<OverallResult success="true"/>
|
||||||
|
</TestCase>
|
||||||
<TestCase name="Character pretty printing" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
|
<TestCase name="Character pretty printing" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
|
||||||
<Section name="Specifically escaped" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
|
<Section name="Specifically escaped" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
|
||||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/ToStringGeneralTests.cpp" >
|
||||||
@@ -1010,10 +1110,7 @@
|
|||||||
<OverallResult success="false"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Custom std-exceptions can be custom translated" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<TestCase name="Custom std-exceptions can be custom translated" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<OverallResult success="true"/>
|
||||||
custom std exception
|
|
||||||
</Exception>
|
|
||||||
<OverallResult success="false"/>
|
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Demonstrate that a non-const == is not used" tags="[Tricky]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
<TestCase name="Demonstrate that a non-const == is not used" tags="[Tricky]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/TrickyTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||||
@@ -1328,6 +1425,15 @@
|
|||||||
<Failure filename="projects/<exe-name>/MessageTests.cpp" />
|
<Failure filename="projects/<exe-name>/MessageTests.cpp" />
|
||||||
<OverallResult success="false"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
|
<TestCase name="FAIL_CHECK does not abort the test" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
|
<Failure filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
|
This is a failure
|
||||||
|
</Failure>
|
||||||
|
<Warning>
|
||||||
|
This message appears in the output
|
||||||
|
</Warning>
|
||||||
|
<OverallResult success="false"/>
|
||||||
|
</TestCase>
|
||||||
<TestCase name="Factorials are computed" tags="[factorial]" filename="projects/<exe-name>/MiscTests.cpp" >
|
<TestCase name="Factorials are computed" tags="[factorial]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MiscTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
@@ -2607,6 +2713,9 @@
|
|||||||
<OverallResult success="false"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="INFO gets logged on failure, even if captured before successful assertions" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
<TestCase name="INFO gets logged on failure, even if captured before successful assertions" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
|
<Info>
|
||||||
|
this message may be logged later
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/MessageTests.cpp" >
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
a == 2
|
a == 2
|
||||||
@@ -2637,6 +2746,9 @@
|
|||||||
2 == 0
|
2 == 0
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Info>
|
||||||
|
but not this
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/MessageTests.cpp" >
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
a == 2
|
a == 2
|
||||||
@@ -3409,7 +3521,7 @@ re>"
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Long text is truncted" tags="[Text][Truncated]" filename="projects/<exe-name>/TestMain.cpp" >
|
<TestCase name="Long text is truncated" tags="[Text][Truncated]" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/TestMain.cpp" >
|
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
t.toString(), EndsWith( "... message truncated due to excessive size" )
|
t.toString(), EndsWith( "... message truncated due to excessive size" )
|
||||||
@@ -4523,10 +4635,7 @@ re>"
|
|||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Non-std exceptions can be translated" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<TestCase name="Non-std exceptions can be translated" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<OverallResult success="true"/>
|
||||||
custom exception
|
|
||||||
</Exception>
|
|
||||||
<OverallResult success="false"/>
|
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="NotImplemented exception" tags="[!throws]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<TestCase name="NotImplemented exception" tags="[!throws]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE_THROWS" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<Expression success="true" type="REQUIRE_THROWS" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
@@ -6150,6 +6259,25 @@ re>"
|
|||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Process can be configured on command line" tags="[command-line][config]" filename="projects/<exe-name>/TestMain.cpp" >
|
<TestCase name="Process can be configured on command line" tags="[command-line][config]" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
|
<Section name="empty args don't cause a crash" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
|
<Expression success="true" type="CHECK_NOTHROW" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
|
<Original>
|
||||||
|
parser.parseInto( std::vector<std::string>(), config )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
parser.parseInto( std::vector<std::string>(), config )
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
|
<Original>
|
||||||
|
config.processName == ""
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
"" == ""
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
<Section name="default - no arguments" filename="projects/<exe-name>/TestMain.cpp" >
|
<Section name="default - no arguments" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
<Expression success="true" type="CHECK_NOTHROW" filename="projects/<exe-name>/TestMain.cpp" >
|
<Expression success="true" type="CHECK_NOTHROW" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
@@ -6159,6 +6287,14 @@ re>"
|
|||||||
parseIntoConfig( argv, config )
|
parseIntoConfig( argv, config )
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
|
<Original>
|
||||||
|
config.processName == "test"
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
"test" == "test"
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TestMain.cpp" >
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
config.shouldDebugBreak == false
|
config.shouldDebugBreak == false
|
||||||
@@ -6191,7 +6327,7 @@ re>"
|
|||||||
true
|
true
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<OverallResults successes="5" failures="0" expectedFailures="0"/>
|
<OverallResults successes="6" failures="0" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
<Section name="test lists" filename="projects/<exe-name>/TestMain.cpp" >
|
<Section name="test lists" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
<Section name="1 test" description="Specify one test case using" filename="projects/<exe-name>/TestMain.cpp" >
|
<Section name="1 test" description="Specify one test case using" filename="projects/<exe-name>/TestMain.cpp" >
|
||||||
@@ -6736,6 +6872,12 @@ re>"
|
|||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="SCOPED_INFO is reset for each loop" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
<TestCase name="SCOPED_INFO is reset for each loop" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
|
<Info>
|
||||||
|
current counter 0
|
||||||
|
</Info>
|
||||||
|
<Info>
|
||||||
|
i := 0
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
i < 10
|
i < 10
|
||||||
@@ -6744,6 +6886,12 @@ re>"
|
|||||||
0 < 10
|
0 < 10
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Info>
|
||||||
|
current counter 1
|
||||||
|
</Info>
|
||||||
|
<Info>
|
||||||
|
i := 1
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
i < 10
|
i < 10
|
||||||
@@ -6752,6 +6900,12 @@ re>"
|
|||||||
1 < 10
|
1 < 10
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Info>
|
||||||
|
current counter 2
|
||||||
|
</Info>
|
||||||
|
<Info>
|
||||||
|
i := 2
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
i < 10
|
i < 10
|
||||||
@@ -6760,6 +6914,12 @@ re>"
|
|||||||
2 < 10
|
2 < 10
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Info>
|
||||||
|
current counter 3
|
||||||
|
</Info>
|
||||||
|
<Info>
|
||||||
|
i := 3
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
i < 10
|
i < 10
|
||||||
@@ -6768,6 +6928,12 @@ re>"
|
|||||||
3 < 10
|
3 < 10
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Info>
|
||||||
|
current counter 4
|
||||||
|
</Info>
|
||||||
|
<Info>
|
||||||
|
i := 4
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
i < 10
|
i < 10
|
||||||
@@ -6776,6 +6942,12 @@ re>"
|
|||||||
4 < 10
|
4 < 10
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Info>
|
||||||
|
current counter 5
|
||||||
|
</Info>
|
||||||
|
<Info>
|
||||||
|
i := 5
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
i < 10
|
i < 10
|
||||||
@@ -6784,6 +6956,12 @@ re>"
|
|||||||
5 < 10
|
5 < 10
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Info>
|
||||||
|
current counter 6
|
||||||
|
</Info>
|
||||||
|
<Info>
|
||||||
|
i := 6
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
i < 10
|
i < 10
|
||||||
@@ -6792,6 +6970,12 @@ re>"
|
|||||||
6 < 10
|
6 < 10
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Info>
|
||||||
|
current counter 7
|
||||||
|
</Info>
|
||||||
|
<Info>
|
||||||
|
i := 7
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
i < 10
|
i < 10
|
||||||
@@ -6800,6 +6984,12 @@ re>"
|
|||||||
7 < 10
|
7 < 10
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Info>
|
||||||
|
current counter 8
|
||||||
|
</Info>
|
||||||
|
<Info>
|
||||||
|
i := 8
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
i < 10
|
i < 10
|
||||||
@@ -6808,6 +6998,12 @@ re>"
|
|||||||
8 < 10
|
8 < 10
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Info>
|
||||||
|
current counter 9
|
||||||
|
</Info>
|
||||||
|
<Info>
|
||||||
|
i := 9
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
i < 10
|
i < 10
|
||||||
@@ -7156,7 +7352,8 @@ hello
|
|||||||
<Expanded>
|
<Expanded>
|
||||||
"error: tag alias, "[@zzz]" already registered.
|
"error: tag alias, "[@zzz]" already registered.
|
||||||
First seen at file:2
|
First seen at file:2
|
||||||
Redefined at file:10" contains: "[@zzz]"
|
Redefined at file:10
|
||||||
|
" contains: "[@zzz]"
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/TagAliasTests.cpp" >
|
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/TagAliasTests.cpp" >
|
||||||
@@ -7166,7 +7363,8 @@ hello
|
|||||||
<Expanded>
|
<Expanded>
|
||||||
"error: tag alias, "[@zzz]" already registered.
|
"error: tag alias, "[@zzz]" already registered.
|
||||||
First seen at file:2
|
First seen at file:2
|
||||||
Redefined at file:10" contains: "file"
|
Redefined at file:10
|
||||||
|
" contains: "file"
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/TagAliasTests.cpp" >
|
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/TagAliasTests.cpp" >
|
||||||
@@ -7176,7 +7374,8 @@ hello
|
|||||||
<Expanded>
|
<Expanded>
|
||||||
"error: tag alias, "[@zzz]" already registered.
|
"error: tag alias, "[@zzz]" already registered.
|
||||||
First seen at file:2
|
First seen at file:2
|
||||||
Redefined at file:10" contains: "2"
|
Redefined at file:10
|
||||||
|
" contains: "2"
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/TagAliasTests.cpp" >
|
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/TagAliasTests.cpp" >
|
||||||
@@ -7186,7 +7385,8 @@ hello
|
|||||||
<Expanded>
|
<Expanded>
|
||||||
"error: tag alias, "[@zzz]" already registered.
|
"error: tag alias, "[@zzz]" already registered.
|
||||||
First seen at file:2
|
First seen at file:2
|
||||||
Redefined at file:10" contains: "10"
|
Redefined at file:10
|
||||||
|
" contains: "10"
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
||||||
@@ -8386,10 +8586,7 @@ there"
|
|||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Unexpected exceptions can be translated" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<TestCase name="Unexpected exceptions can be translated" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<OverallResult success="true"/>
|
||||||
3.14
|
|
||||||
</Exception>
|
|
||||||
<OverallResult success="false"/>
|
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Use a custom approx" tags="[Approx][custom]" filename="projects/<exe-name>/ApproxTests.cpp" >
|
<TestCase name="Use a custom approx" tags="[Approx][custom]" filename="projects/<exe-name>/ApproxTests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ApproxTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ApproxTests.cpp" >
|
||||||
@@ -8652,10 +8849,7 @@ there"
|
|||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="When unchecked exceptions are thrown directly they are always failures" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<TestCase name="When unchecked exceptions are thrown directly they are always failures" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<OverallResult success="true"/>
|
||||||
unexpected exception
|
|
||||||
</Exception>
|
|
||||||
<OverallResult success="false"/>
|
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="When unchecked exceptions are thrown during a CHECK the test should continue" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<TestCase name="When unchecked exceptions are thrown during a CHECK the test should continue" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<Expression success="false" type="CHECK" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
@@ -8701,12 +8895,9 @@ there"
|
|||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="When unchecked exceptions are thrown from sections they are always failures" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<TestCase name="When unchecked exceptions are thrown from sections they are always failures" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Section name="section name" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<Section name="section name" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<OverallResults successes="0" failures="0" expectedFailures="0"/>
|
||||||
unexpected exception
|
|
||||||
</Exception>
|
|
||||||
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
|
||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="false"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test" tags="[!throws]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
<TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test" tags="[!throws]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
@@ -9086,6 +9277,9 @@ spanner <OverallResult success="true"/>
|
|||||||
1 == 0
|
1 == 0
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Info>
|
||||||
|
Testing if fib[2] (2) is even
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/MiscTests.cpp" >
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
( fib[i] % 2 ) == 0
|
( fib[i] % 2 ) == 0
|
||||||
@@ -9116,6 +9310,9 @@ spanner <OverallResult success="true"/>
|
|||||||
1 == 0
|
1 == 0
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
|
<Info>
|
||||||
|
Testing if fib[5] (8) is even
|
||||||
|
</Info>
|
||||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/MiscTests.cpp" >
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
( fib[i] % 2 ) == 0
|
( fib[i] % 2 ) == 0
|
||||||
@@ -9885,7 +10082,7 @@ spanner <OverallResult success="true"/>
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<OverallResults successes="849" failures="89" expectedFailures="18"/>
|
<OverallResults successes="859" failures="84" expectedFailures="20"/>
|
||||||
</Group>
|
</Group>
|
||||||
<OverallResults successes="849" failures="88" expectedFailures="18"/>
|
<OverallResults successes="859" failures="83" expectedFailures="20"/>
|
||||||
</Catch>
|
</Catch>
|
||||||
|
@@ -23,20 +23,50 @@ TEST_CASE("#809") {
|
|||||||
REQUIRE(42 == f);
|
REQUIRE(42 == f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
// REQUIRE_THROWS_AS was changed to catch exceptions by const&
|
|
||||||
// using type traits. This means that this should compile cleanly
|
|
||||||
|
|
||||||
// Provides indirection to prevent unreachable-code warnings
|
// ------------------------------------------------------------------
|
||||||
|
// Changes to REQUIRE_THROWS_AS made it stop working in a template in
|
||||||
|
// an unfixable way (as long as C++03 compatibility is being kept).
|
||||||
|
// To prevent these from happening in the future, this needs to compile
|
||||||
|
|
||||||
void throws_int(bool b) {
|
void throws_int(bool b) {
|
||||||
if (b) {
|
if (b) {
|
||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("#542") {
|
template <typename T>
|
||||||
CHECK_THROWS_AS(throws_int(true), int);
|
bool templated_tests(T t) {
|
||||||
CHECK_THROWS_AS(throws_int(true), int&);
|
int a = 3;
|
||||||
CHECK_THROWS_AS(throws_int(true), const int);
|
REQUIRE(a == t);
|
||||||
|
CHECK(a == t);
|
||||||
|
REQUIRE_THROWS(throws_int(true));
|
||||||
CHECK_THROWS_AS(throws_int(true), const int&);
|
CHECK_THROWS_AS(throws_int(true), const int&);
|
||||||
|
REQUIRE_NOTHROW(throws_int(false));
|
||||||
|
REQUIRE_THAT("aaa", Catch::EndsWith("aaa"));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("#833") {
|
||||||
|
REQUIRE(templated_tests<int>(3));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test containing example where original stream insertable check breaks compilation
|
||||||
|
#if defined (CATCH_CONFIG_CPP11_STREAM_INSERTABLE_CHECK)
|
||||||
|
namespace {
|
||||||
|
struct A {};
|
||||||
|
std::ostream& operator<< (std::ostream &o, const A &) { return o << 0; }
|
||||||
|
|
||||||
|
struct B : private A {
|
||||||
|
bool operator== (int) const { return true; }
|
||||||
|
};
|
||||||
|
|
||||||
|
B f ();
|
||||||
|
std::ostream g ();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE( "#872" ) {
|
||||||
|
B x;
|
||||||
|
REQUIRE (x == 4);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -11,6 +11,10 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable:4702) // Unreachable code -- MSVC 19 (VS 2015) sees right through the indirection
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
inline int thisThrows()
|
inline int thisThrows()
|
||||||
@@ -205,3 +209,18 @@ TEST_CASE( "Mismatching exception messages failing the test", "[.][failing][!thr
|
|||||||
REQUIRE_THROWS_WITH( thisThrows(), "should fail" );
|
REQUIRE_THROWS_WITH( thisThrows(), "should fail" );
|
||||||
REQUIRE_THROWS_WITH( thisThrows(), "expected exception" );
|
REQUIRE_THROWS_WITH( thisThrows(), "expected exception" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE( "#748 - captures with unexpected exceptions", "[!shouldfail][!throws]" ) {
|
||||||
|
int answer = 42;
|
||||||
|
CAPTURE( answer );
|
||||||
|
// the message should be printed on the first two sections but not on the third
|
||||||
|
SECTION( "outside assertions" ) {
|
||||||
|
thisThrows();
|
||||||
|
}
|
||||||
|
SECTION( "inside REQUIRE_NOTHROW" ) {
|
||||||
|
REQUIRE_NOTHROW( thisThrows() );
|
||||||
|
}
|
||||||
|
SECTION( "inside REQUIRE_THROWS" ) {
|
||||||
|
REQUIRE_THROWS( thisThrows() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -53,6 +53,13 @@ TEST_CASE( "INFO gets logged on failure, even if captured before successful asse
|
|||||||
TEST_CASE( "FAIL aborts the test", "[failing][messages][.]" )
|
TEST_CASE( "FAIL aborts the test", "[failing][messages][.]" )
|
||||||
{
|
{
|
||||||
FAIL( "This is a " << "failure" ); // This should output the message and abort
|
FAIL( "This is a " << "failure" ); // This should output the message and abort
|
||||||
|
WARN( "We should never see this");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE( "FAIL_CHECK does not abort the test", "[failing][messages][.]" )
|
||||||
|
{
|
||||||
|
FAIL_CHECK( "This is a " << "failure" ); // This should output the message then continue
|
||||||
|
WARN( "This message appears in the output");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#include "../include/internal/catch_xmlwriter.hpp"
|
#include "../include/internal/catch_xmlwriter.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <cerrno>
|
||||||
|
|
||||||
TEST_CASE( "random SECTION tests", "[.][sections][failing]" )
|
TEST_CASE( "random SECTION tests", "[.][sections][failing]" )
|
||||||
{
|
{
|
||||||
@@ -393,3 +394,14 @@ TEST_CASE( "This test 'should' fail but doesn't", "[.][failing][!shouldfail]" )
|
|||||||
TEST_CASE( "# A test name that starts with a #" ) {
|
TEST_CASE( "# A test name that starts with a #" ) {
|
||||||
SUCCEED( "yay" );
|
SUCCEED( "yay" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int f() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE( "#835 -- errno should not be touched by Catch", "[!shouldfail]" ) {
|
||||||
|
errno = 1;
|
||||||
|
CHECK(f() == 0);
|
||||||
|
REQUIRE(errno == 1); // Check that f() doesn't touch errno.
|
||||||
|
}
|
||||||
|
@@ -51,10 +51,18 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
|||||||
|
|
||||||
Catch::ConfigData config;
|
Catch::ConfigData config;
|
||||||
|
|
||||||
|
SECTION( "empty args don't cause a crash" ) {
|
||||||
|
Catch::Clara::CommandLine<Catch::ConfigData> parser = Catch::makeCommandLineParser();
|
||||||
|
CHECK_NOTHROW( parser.parseInto( std::vector<std::string>(), config ) );
|
||||||
|
|
||||||
|
CHECK( config.processName == "" );
|
||||||
|
}
|
||||||
|
|
||||||
SECTION( "default - no arguments", "" ) {
|
SECTION( "default - no arguments", "" ) {
|
||||||
const char* argv[] = { "test" };
|
const char* argv[] = { "test" };
|
||||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||||
|
|
||||||
|
CHECK( config.processName == "test" );
|
||||||
CHECK( config.shouldDebugBreak == false );
|
CHECK( config.shouldDebugBreak == false );
|
||||||
CHECK( config.abortAfter == -1 );
|
CHECK( config.abortAfter == -1 );
|
||||||
CHECK( config.noThrow == false );
|
CHECK( config.noThrow == false );
|
||||||
|
@@ -38,3 +38,17 @@ TEST_CASE( "Character pretty printing" ){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_CASE( "Capture and info messages" ) {
|
||||||
|
SECTION("Capture should stringify like assertions") {
|
||||||
|
int i = 2;
|
||||||
|
CAPTURE(i);
|
||||||
|
REQUIRE(true);
|
||||||
|
}
|
||||||
|
SECTION("Info should NOT stringify the way assertions do") {
|
||||||
|
int i = 3;
|
||||||
|
INFO(i);
|
||||||
|
REQUIRE(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -124,16 +124,18 @@ args = parser.parse_args()
|
|||||||
compiler_path = args.compiler
|
compiler_path = args.compiler
|
||||||
catch_path = args.catch_header
|
catch_path = args.catch_header
|
||||||
|
|
||||||
os.chdir(dir_name)
|
|
||||||
if args.generate_files:
|
if args.generate_files:
|
||||||
create_temp_dir()
|
create_temp_dir()
|
||||||
copy_catch(catch_path)
|
copy_catch(catch_path)
|
||||||
|
os.chdir(dir_name)
|
||||||
# now create the fake test files
|
# now create the fake test files
|
||||||
generate_files()
|
generate_files()
|
||||||
# Early exit
|
# Early exit
|
||||||
print('Finished generating files')
|
print('Finished generating files')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
os.chdir(dir_name)
|
||||||
|
|
||||||
if args.flags:
|
if args.flags:
|
||||||
flags = args.flags
|
flags = args.flags
|
||||||
|
|
||||||
|
0
scripts/developBuild.py
Normal file → Executable file
0
scripts/developBuild.py
Normal file → Executable file
@@ -7,7 +7,7 @@ import string
|
|||||||
|
|
||||||
from scriptCommon import catchPath
|
from scriptCommon import catchPath
|
||||||
|
|
||||||
versionParser = re.compile( r'(\s*Version\slibraryVersion)\s*\(\s*(.*)\s*,\s*(.*)\s*,\s*(.*)\s*,\s*\"(.*)\"\s*,\s*(.*)\s*\).*' )
|
versionParser = re.compile( r'(\s*static\sVersion\sversion)\s*\(\s*(.*)\s*,\s*(.*)\s*,\s*(.*)\s*,\s*\"(.*)\"\s*,\s*(.*)\s*\).*' )
|
||||||
rootPath = os.path.join( catchPath, 'include/' )
|
rootPath = os.path.join( catchPath, 'include/' )
|
||||||
versionPath = os.path.join( rootPath, "internal/catch_version.hpp" )
|
versionPath = os.path.join( rootPath, "internal/catch_version.hpp" )
|
||||||
readmePath = os.path.join( catchPath, "README.md" )
|
readmePath = os.path.join( catchPath, "README.md" )
|
||||||
@@ -75,7 +75,6 @@ class Version:
|
|||||||
f.write( line + "\n" )
|
f.write( line + "\n" )
|
||||||
|
|
||||||
def updateReadmeFile(self):
|
def updateReadmeFile(self):
|
||||||
versionParser = re.compile( r'\*v\d+\.\d+\.\d+\*' )
|
|
||||||
downloadParser = re.compile( r'<a href=\"https://github.com/philsquared/Catch/releases/download/v\d+\.\d+\.\d+/catch.hpp\">' )
|
downloadParser = re.compile( r'<a href=\"https://github.com/philsquared/Catch/releases/download/v\d+\.\d+\.\d+/catch.hpp\">' )
|
||||||
f = open( readmePath, 'r' )
|
f = open( readmePath, 'r' )
|
||||||
lines = []
|
lines = []
|
||||||
@@ -84,7 +83,6 @@ class Version:
|
|||||||
f.close()
|
f.close()
|
||||||
f = open( readmePath, 'w' )
|
f = open( readmePath, 'w' )
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line = versionParser.sub( '*v{0}*'.format(self.getVersionString()), line)
|
|
||||||
line = downloadParser.sub( r'<a href="https://github.com/philsquared/Catch/releases/download/v{0}/catch.hpp">'.format(self.getVersionString()) , line)
|
line = downloadParser.sub( r'<a href="https://github.com/philsquared/Catch/releases/download/v{0}/catch.hpp">'.format(self.getVersionString()) , line)
|
||||||
f.write( line + "\n" )
|
f.write( line + "\n" )
|
||||||
|
|
||||||
|
0
scripts/releaseNotes.py
Normal file → Executable file
0
scripts/releaseNotes.py
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user