A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
Go to file
Tiago Macarios 0b993d7436 Fix catch exception by reference
When compiling our codebase with clang we were getting the following
error:

GSL/tests/algorithm_tests.cpp:198:58: warning: catch handler catches by
value; should catch by reference instead
[misc-throw-by-value-catch-by-reference]
    CHECK_THROWS_AS(copy(src_span_dyn, dst_span_static), fail_fast);
                                                             ^
Looking at the catch source code exceptions were being caught by value.
One could have it designed so that users might say:

CHECK_THROWS_AS(copy(src_span_dyn, dst_span_static), fail_fast&);

But I don't think this is the intent and looking at the Catch tests
itself looks like this macro does not expect the reference:

    REQUIRE_THROWS_AS( thisThrows(), std::domain_error );
    CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error );

This commit makes Catch catch exceptions by reference instead of by
value.
2017-10-24 20:58:23 -07:00
.github Added "How to test changes in PR" section to documentation 2017-06-22 18:56:10 +02:00
contrib added PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS option 2017-10-15 17:58:39 +02:00
docs Fix very minor typo 2017-10-24 20:00:27 +02:00
include Fix catch exception by reference 2017-10-24 20:58:23 -07:00
projects Fix catch exception by reference 2017-10-24 20:58:23 -07:00
scripts Fix updateVcpkgPackage 2017-08-27 11:43:55 +02:00
single_include v1.10.0 2017-08-26 15:34:18 +02:00
test_package v1.10.0 2017-08-26 15:34:18 +02:00
.gitattributes Git Attributes, with control for line-endings 2013-10-18 07:53:05 +01:00
.gitignore Ignore .vs folder 2017-02-21 08:52:08 +00:00
.travis.yml Disable build broken by travis changes 2017-07-29 08:45:52 +02:00
appveyor.yml Added Win32 UNICODE wmain support (#903) 2017-05-11 13:00:03 +02:00
catch-hand-icon.png Updated artwork 2017-03-01 16:47:04 +00:00
catch-icon-tiny.png Updated artwork 2017-03-01 16:47:04 +00:00
catch-logo-small.png Resized main logo again 2017-03-01 17:00:33 +00:00
CMakeLists.txt Add test for #914 (stringify truthy exprs in standard way) 2017-05-27 14:42:05 +02:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2017-08-17 07:45:12 +01:00
conanfile.py Minor - added header-only flag in conan 2017-08-28 12:18:54 +02:00
LICENSE.txt Renamed licence file, license should now be detected by github 2017-03-20 08:59:25 +01:00
README.md v1.10.0 2017-08-26 15:34:18 +02:00

catch logo

Github Releases Build Status Build status Try online

The latest, single header, version can be downloaded directly using this link

What's the Catch?

Catch stands for C++ Automated Test Cases in Headers and is a multi-paradigm automated test framework for C++ and Objective-C (and, maybe, C). It is implemented entirely in a set of header files, but is packaged up as a single header for extra convenience.

How to use it

This documentation comprises these three parts:

More

Help us out

We're currently running a survey to help us shape the future of Catch. Please take a few moments to fill it out (there's only ten questions).