diff options
| author | Phil Nash | 2017-04-26 16:10:18 +0100 |
|---|---|---|
| committer | Phil Nash | 2017-04-26 16:10:18 +0100 |
| commit | d17d94e45d3223985158ac7cda8b9fead191da4f (patch) | |
| tree | 4803a6842e6a4715f9fa58dead94ebc74d815e02 /include | |
| parent | 8ccbf63f28efe0cd8672dfc1d0b993027cb02ab3 (diff) | |
| download | catch3-d17d94e45d3223985158ac7cda8b9fead191da4f.tar.gz | |
Made INTERNAL_CATCH_TEST variadic so commas in assertions work
Diffstat (limited to 'include')
| -rw-r--r-- | include/internal/catch_capture.hpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index ee3dd598..b0418d46 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -65,19 +65,19 @@ /////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_TEST( macroName, resultDisposition, expr ) \ +#define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \ do { \ - Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ + Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #__VA_ARGS__, resultDisposition ); \ try { \ CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ - ( __catchResult <= expr ).endExpression(); \ + ( __catchResult <= __VA_ARGS__ ).endExpression(); \ CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ } \ catch( ... ) { \ __catchResult.useActiveException( resultDisposition ); \ } \ 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 + } while( Catch::isTrue( false && static_cast<bool>( !!(__VA_ARGS__) ) ) ) // the expression 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 &&. /////////////////////////////////////////////////////////////////////////////// |