mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-24 21:49:24 +00:00
Added self-test for section ordering
Added MockReporter for tracking test runs. Added intrusive smart pointer. Config holds reporter by smart pointer, so we can route the mock reporter through multiple test runs
This commit is contained in:
parent
83a66a6255
commit
b213202ad7
16 changed files with 432 additions and 67 deletions
|
@ -126,22 +126,22 @@ TEST_CASE( "./failing/exceptions/in-section", "Exceptions thrown from sections r
|
|||
TEST_CASE( "./succeeding/exceptions/error messages", "The error messages produced by exceptions caught by Catch matched the expected form" )
|
||||
{
|
||||
Catch::EmbeddedRunner runner;
|
||||
using namespace Catch::Matchers;
|
||||
|
||||
SECTION( "custom, unexpected", "" )
|
||||
{
|
||||
runner.runMatching( "./failing/exceptions/custom" );
|
||||
INFO( runner.getOutput() );
|
||||
CHECK( runner.getOutput().find( "Unexpected exception" ) != std::string::npos );
|
||||
CHECK( runner.getOutput().find( "custom exception" ) != std::string::npos );
|
||||
// CHECK_THAT( runner.getLog(), Contains( "Unexpected exception" ) ); // Mock reporter doesn't say this
|
||||
CHECK_THAT( runner.getLog(), Contains( "custom exception" ) );
|
||||
}
|
||||
|
||||
SECTION( "in section", "" )
|
||||
{
|
||||
runner.runMatching( "./failing/exceptions/in-section" );
|
||||
INFO( runner.getOutput() );
|
||||
CHECK( runner.getOutput().find( "Unexpected exception" ) != std::string::npos );
|
||||
CHECK( runner.getOutput().find( "Exception from section" ) != std::string::npos );
|
||||
CHECK( runner.getOutput().find( CATCH_GET_LINE_INFO( "the section2" ) ) != std::string::npos );
|
||||
INFO( runner.getLog() );
|
||||
// CHECK( runner.getLog().find( "Unexpected exception" ) != std::string::npos ); // Mock reporter doesn't say this
|
||||
CHECK_THAT( runner.getLog(), Contains( "Exception from section" ) );
|
||||
// CHECK( runner.getLog().find( CATCH_GET_LINE_INFO( "the section2" ) ) != std::string::npos ); // Mock reporter doesn't say this
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue