mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-17 19:22:25 +01:00
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)
0b993d7436
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. |
||
---|---|---|
.github | ||
contrib | ||
docs | ||
include | ||
projects | ||
scripts | ||
single_include | ||
test_package | ||
.gitattributes | ||
.gitignore | ||
.travis.yml | ||
appveyor.yml | ||
catch-hand-icon.png | ||
catch-icon-tiny.png | ||
catch-logo-small.png | ||
CMakeLists.txt | ||
CODE_OF_CONDUCT.md | ||
conanfile.py | ||
LICENSE.txt | ||
README.md |
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:
- Why do we need yet another C++ Test Framework?
- Tutorial - getting started
- Reference section - all the details
More
- Issues and bugs can be raised on the Issue tracker on GitHub
- For discussion or questions please use the dedicated Google Groups forum
- See who else is using Catch
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).