Add explanation of THROW assertion limits + using lambda

This commit is contained in:
Martin Hořeňovský 2017-02-06 16:08:13 +01:00
parent cd489d9647
commit f126d7943a
1 changed files with 14 additions and 0 deletions

View File

@ -78,6 +78,20 @@ Expects that an exception of the _specified type_ is thrown during evaluation of
Expects that no exception is thrown during evaluation of the expression. Expects that no exception is thrown during evaluation of the expression.
Please note that the `THROW` family of assertions expects to be passed a single expression, not a statement or series of statements. If you want to check a more complicated sequence of operations, you can use a C++11 lambda function.
```cpp
REQUIRE_NOTHROW([&](){
int i = 1;
int j = 2;
auto k = i + j;
if (k == 3) {
throw 1;
}
}());
```
## Matcher expressions ## Matcher expressions
To support Matchers a slightly different form is used. Matchers will be more fully documented elsewhere. *Note that Matchers are still at early stage development and are subject to change.* To support Matchers a slightly different form is used. Matchers will be more fully documented elsewhere. *Note that Matchers are still at early stage development and are subject to change.*