mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
console reporter:
Always print test case + sections in header for every new section. Group sections into single block Tweaked BDD mappings to print out nicely with above
This commit is contained in:
parent
097282e00e
commit
f8ba2277d3
@ -79,14 +79,12 @@ namespace Catch
|
|||||||
struct ThreadedSectionInfo : SectionInfo, SharedImpl<> {
|
struct ThreadedSectionInfo : SectionInfo, SharedImpl<> {
|
||||||
ThreadedSectionInfo( SectionInfo const& _sectionInfo, Ptr<ThreadedSectionInfo> const& _parent = Ptr<ThreadedSectionInfo>() )
|
ThreadedSectionInfo( SectionInfo const& _sectionInfo, Ptr<ThreadedSectionInfo> const& _parent = Ptr<ThreadedSectionInfo>() )
|
||||||
: SectionInfo( _sectionInfo ),
|
: SectionInfo( _sectionInfo ),
|
||||||
parent( _parent ),
|
parent( _parent )
|
||||||
printed( false )
|
|
||||||
{}
|
{}
|
||||||
virtual ~ThreadedSectionInfo();
|
virtual ~ThreadedSectionInfo();
|
||||||
|
|
||||||
std::vector<Ptr<ThreadedSectionInfo> > children;
|
std::vector<Ptr<ThreadedSectionInfo> > children;
|
||||||
Ptr<ThreadedSectionInfo> parent;
|
Ptr<ThreadedSectionInfo> parent;
|
||||||
bool printed;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AssertionStats {
|
struct AssertionStats {
|
||||||
|
@ -213,7 +213,7 @@ namespace Catch {
|
|||||||
|
|
||||||
void lazyPrint() {
|
void lazyPrint() {
|
||||||
|
|
||||||
bool needsNewline = unusedTestCaseInfo || ( currentSectionInfo && !currentSectionInfo->printed );
|
bool needsNewline = unusedTestCaseInfo || currentSectionInfo;
|
||||||
|
|
||||||
if( testRunInfo )
|
if( testRunInfo )
|
||||||
lazyPrintRunInfo();
|
lazyPrintRunInfo();
|
||||||
@ -221,7 +221,7 @@ namespace Catch {
|
|||||||
lazyPrintGroupInfo();
|
lazyPrintGroupInfo();
|
||||||
if( unusedTestCaseInfo )
|
if( unusedTestCaseInfo )
|
||||||
lazyPrintTestCaseInfo();
|
lazyPrintTestCaseInfo();
|
||||||
if( currentSectionInfo && !currentSectionInfo->printed )
|
if( currentSectionInfo)
|
||||||
lazyPrintSectionInfo();
|
lazyPrintSectionInfo();
|
||||||
if( needsNewline )
|
if( needsNewline )
|
||||||
stream << "\n";
|
stream << "\n";
|
||||||
@ -285,7 +285,6 @@ namespace Catch {
|
|||||||
else
|
else
|
||||||
stream << inset;
|
stream << inset;
|
||||||
stream << (*it)->name << "\n";
|
stream << (*it)->name << "\n";
|
||||||
// (*it)->printed = true; // !TBD remove flag?
|
|
||||||
}
|
}
|
||||||
stream << getDashes() << std::endl;
|
stream << getDashes() << std::endl;
|
||||||
unusedSectionInfo.reset();
|
unusedSectionInfo.reset();
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -12,31 +12,22 @@
|
|||||||
|
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
|
|
||||||
#define STORY( a, b )
|
// !TBD: story scenarios map to class based tests
|
||||||
#define SCENARIO( storyName, desc ) TEST_CASE( desc, "" )
|
#define SCENARIO( name, tags ) TEST_CASE( "Scenario: " name, tags )
|
||||||
#define GIVEN( desc ) SECTION( desc, "" )
|
#define GIVEN( desc ) SECTION( "Given: " desc, "" )
|
||||||
#define WHEN( desc ) SECTION( desc, "" )
|
#define WHEN( desc ) SECTION( "When: " desc, "" )
|
||||||
#define THEN( desc ) SECTION( desc, "" )
|
#define THEN( desc ) SECTION( "Then: " desc, "" )
|
||||||
|
|
||||||
inline bool itDoesThis(){ return true; }
|
inline bool itDoesThis(){ return true; }
|
||||||
|
|
||||||
STORY( storyName, "once upon a time" )
|
SCENARIO( "Do that thing with the thing", "[tags]" ) {
|
||||||
|
GIVEN( "This stuff exists" ) {
|
||||||
SCENARIO( storyName, "scenario name" )
|
|
||||||
{
|
|
||||||
GIVEN( "This stuff exists" )
|
|
||||||
{
|
|
||||||
// make stuff exist
|
// make stuff exist
|
||||||
|
WHEN( "I do this" ) {
|
||||||
WHEN( "I do this" )
|
|
||||||
{
|
|
||||||
// do this
|
// do this
|
||||||
|
|
||||||
THEN( "it should do this")
|
THEN( "it should do this")
|
||||||
{
|
|
||||||
REQUIRE( itDoesThis() );
|
REQUIRE( itDoesThis() );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user