mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Tidied up some loose ends with reporting test cases and sections (now handles them as a single block).
This should fixes an issue where sections not being printed when they should be (and reverses a workaround where they were being printed too much)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -314,3 +314,62 @@ TEST_CASE( "./succeeding/SafeBool", "Objects that evaluated in boolean contexts
|
||||
CHECK( !False );
|
||||
CHECK_FALSE( False );
|
||||
}
|
||||
|
||||
TEST_CASE( "Assertions then sections", "" )
|
||||
{
|
||||
// This was causing a failure due to the way the console reporter was handling
|
||||
// the current section
|
||||
|
||||
REQUIRE( Catch::isTrue( true ) );
|
||||
|
||||
SECTION( "A section", "" )
|
||||
{
|
||||
REQUIRE( Catch::isTrue( true ) );
|
||||
|
||||
SECTION( "Another section", "" )
|
||||
{
|
||||
REQUIRE( Catch::isTrue( true ) );
|
||||
}
|
||||
SECTION( "Another other section", "" )
|
||||
{
|
||||
REQUIRE( Catch::isTrue( true ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void sort( std::vector<int>& v ) {
|
||||
std::sort( v.begin(), v.end() );
|
||||
}
|
||||
|
||||
TEST_CASE( "sort", "" ) {
|
||||
std::vector<int> v;
|
||||
v.push_back( 3 );
|
||||
v.push_back( 2 );
|
||||
v.push_back( 4 );
|
||||
|
||||
std::vector<int> sorted;
|
||||
sorted.push_back( 2 );
|
||||
sorted.push_back( 3 );
|
||||
sorted.push_back( 4 );
|
||||
|
||||
sort( v );
|
||||
|
||||
REQUIRE( v == sorted );
|
||||
|
||||
SECTION( "already sorted", "" ) {
|
||||
sort( v );
|
||||
|
||||
REQUIRE( v == sorted );
|
||||
|
||||
}
|
||||
SECTION( "reverse sorted", "" ) {
|
||||
std::reverse( v.begin(), v.end() );
|
||||
|
||||
REQUIRE( v != sorted );
|
||||
|
||||
sort( v );
|
||||
|
||||
REQUIRE( v == sorted );
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user