From f4c0a1848db323a673e4c816fd75a82e61754fb4 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Sun, 9 Dec 2012 21:46:15 +0000 Subject: [PATCH] console reporter is now a full replacement for the basic reporter, using the new streaming interface directly --- approvalTests.py | 7 ++++--- include/reporters/catch_reporter_console.hpp | 2 ++ projects/SelfTest/Baselines/approvedResults.txt | 13 +++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/approvalTests.py b/approvalTests.py index 6910cba2..29543425 100644 --- a/approvalTests.py +++ b/approvalTests.py @@ -14,9 +14,10 @@ filteredResultsPath = os.path.join( catchPath, 'projects/SelfTest/Baselines/unap cmdPath = sys.argv[1] f = open( rawResultsPath, 'w' ) -subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "basic" ], stdout=f, stderr=f ) -subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "basic", "-a", "4" ], stdout=f, stderr=f ) -#subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "console" ], stdout=f, stderr=f ) +#subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "basic" ], stdout=f, stderr=f ) +#subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "basic", "-a", "4" ], stdout=f, stderr=f ) +subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "console" ], stdout=f, stderr=f ) +subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "console", "-a", "4" ], stdout=f, stderr=f ) subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "junit" ], stdout=f, stderr=f ) subprocess.call([ cmdPath, "~dummy", "-s", "-w", "NoAssertions", "-r", "xml" ], stdout=f, stderr=f ) f.close() diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp index 2b9b75fb..fabcc4f7 100644 --- a/include/reporters/catch_reporter_console.hpp +++ b/include/reporters/catch_reporter_console.hpp @@ -46,6 +46,8 @@ namespace Catch { } std::string makeSectionPath( ThreadedSectionInfo const * section, std::string const& delimiter ) { std::string sectionPath = "'" + section->name + "'"; + + // !TBD: Do this without the assignment in the while as it causes warnings: while( ( section = section->parent.get() ) ) sectionPath = "'" + section->name + "'" + delimiter + sectionPath; return sectionPath; diff --git a/projects/SelfTest/Baselines/approvedResults.txt b/projects/SelfTest/Baselines/approvedResults.txt index 295ab9be..f2f31a07 100644 --- a/projects/SelfTest/Baselines/approvedResults.txt +++ b/projects/SelfTest/Baselines/approvedResults.txt @@ -1,6 +1,5 @@ [Started testing: CatchSelfTest] [Started group: '~dummy'] - [Running: ./succeeding/Approx/simple] ApproxTests.cpp:20: d == Approx( 1.23 ) succeeded for: 1.23 == Approx( 1.23 ) ApproxTests.cpp:21: d != Approx( 1.22 ) succeeded for: 1.23 != Approx( 1.22 ) @@ -453,7 +452,6 @@ MessageTests.cpp:51: failed with message: 'This is a failure' [Finished: './failing/message/fail' 1 test case failed (1 assertion failed)] [Running: ./failing/message/sections] - [Started section: 'one'] MessageTests.cpp:58: failed with message: 'Message from section one' [End of section: 'one' 1 assertion failed] @@ -463,8 +461,8 @@ MessageTests.cpp:63: failed with message: 'Message from section two' [End of section: 'two' 1 assertion failed] [Finished: './failing/message/sections' 1 test case failed (All 2 assertions failed)] -Message from section one +Message from section one [Running: ./succeeding/message/sections/stdout] [Started section: 'one'] @@ -604,9 +602,9 @@ MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0 MiscTests.cpp:114: [info: Testing if fib[7] (21) is even] MiscTests.cpp:115: ( fib[i] % 2 ) == 0 failed for: 1 == 0 [Finished: './mixed/Misc/loops' 1 test case failed (6 of 8 assertions failed)] + Some information An error - [Running: ./succeeding/Misc/stdout,stderr] No assertions in test case, './succeeding/Misc/stdout,stderr' @@ -1335,14 +1333,13 @@ BDDTests.cpp:37: itDoesThis() succeeded for: true [End of section: 'This stuff exists' 1 assertion passed] [Finished: 'scenario name' All tests passed (1 assertion in 1 test case)] -[End of group: '~dummy'. 44 of 95 test cases failed (101 of 607 assertions failed)] +[End of group '~dummy'. 44 of 95 test cases failed (101 of 607 assertions failed)] [Testing completed. 44 of 95 test cases failed (101 of 607 assertions failed)] [Started testing: CatchSelfTest] [Started group: '~dummy'] - [Running: ./succeeding/Approx/simple] ApproxTests.cpp:20: d == Approx( 1.23 ) succeeded for: 1.23 == Approx( 1.23 ) ApproxTests.cpp:21: d != Approx( 1.22 ) succeeded for: 1.23 != Approx( 1.22 ) @@ -1416,10 +1413,10 @@ ConditionTests.cpp:63: x == Approx( 1.3 ) succeeded for: 1.3 == Approx( 1.3 ) ConditionTests.cpp:71: data.int_seven == 6 failed for: 7 == 6 ConditionTests.cpp:72: data.int_seven == 8 failed for: 7 == 8 [Finished: './failing/conditions/equality' 1 test case failed (All 2 assertions failed)] -[End of group: '~dummy'. 3 of 12 test cases failed (4 of 38 assertions failed)] +[End of group '~dummy'. 3 of 12 test cases failed (4 of 38 assertions failed)] -[Testing aborted. 3 of 12 test cases failed (4 of 38 assertions failed)] +[Testing completed. 3 of 12 test cases failed (4 of 38 assertions failed)]