mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-18 02:45:40 +02:00
More macros are now variadic
Also added tests for them
This commit is contained in:
@@ -396,6 +396,31 @@ TEST_CASE( "has printf", "" ) {
|
||||
}
|
||||
|
||||
TEST_CASE( "assertions with commas are allowed" ) {
|
||||
|
||||
REQUIRE( std::vector<int>{1, 2} == std::vector<int>{1, 2} );
|
||||
}
|
||||
|
||||
namespace {
|
||||
struct constructor_throws {
|
||||
constructor_throws() {
|
||||
throw 1;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
TEST_CASE("Commas in various macros are allowed") {
|
||||
REQUIRE_THROWS( std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} );
|
||||
CHECK_THROWS( std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} );
|
||||
REQUIRE_NOTHROW( std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} );
|
||||
CHECK_NOTHROW( std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} );
|
||||
|
||||
REQUIRE(std::vector<int>{1, 2} == std::vector<int>{1, 2});
|
||||
CHECK( std::vector<int>{1, 2} == std::vector<int>{1, 2} );
|
||||
REQUIRE_FALSE(std::vector<int>{1, 2} == std::vector<int>{1, 2, 3});
|
||||
CHECK_FALSE( std::vector<int>{1, 2} == std::vector<int>{1, 2, 3} );
|
||||
|
||||
CHECK_NOFAIL( std::vector<int>{1, 2} == std::vector<int>{1, 2} );
|
||||
CHECKED_IF( std::vector<int>{1, 2} == std::vector<int>{1, 2} ) {
|
||||
REQUIRE(true);
|
||||
} CHECKED_ELSE( std::vector<int>{1, 2} == std::vector<int>{1, 2} ) {
|
||||
CHECK(true);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user