mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-16 10:05:39 +02:00
Add PredicateMatcher that takes an arbitrary predicate functions
Also adds `Predicate` helper function to create `PredicateMatcher`. Because of limitations in type inference it needs to be explicitly typed, like so `Predicate<std::string>([](std::string const& str) { ... })`. It also takes an optional second argument for description of the predicate. It is possible to infer the argument with sufficient TMP, see https://stackoverflow.com/questions/43560492/how-to-extract-lambdas-return-type-and-variadic-parameters-pack-back-from-gener/43561563#43561563 but I don't think that the magic is worth introducing ATM. Closes #1236
This commit is contained in:
@@ -1084,6 +1084,6 @@ due to unexpected exception with message:
|
||||
Why would you throw a std::string?
|
||||
|
||||
===============================================================================
|
||||
test cases: 203 | 150 passed | 49 failed | 4 failed as expected
|
||||
assertions: 1057 | 929 passed | 107 failed | 21 failed as expected
|
||||
test cases: 204 | 151 passed | 49 failed | 4 failed as expected
|
||||
assertions: 1061 | 933 passed | 107 failed | 21 failed as expected
|
||||
|
||||
|
Reference in New Issue
Block a user