-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue #1514 where the output of failing tests is not redirected to the reporter #1525
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1525 +/- ##
=========================================
+ Coverage 80.58% 80.6% +0.02%
=========================================
Files 121 121
Lines 3383 3386 +3
=========================================
+ Hits 2726 2729 +3
Misses 657 657 |
Codecov Report
@@ Coverage Diff @@
## master #1525 +/- ##
==========================================
+ Coverage 80.54% 80.55% +0.02%
==========================================
Files 121 121
Lines 3386 3389 +3
==========================================
+ Hits 2727 2730 +3
Misses 659 659 |
@@ -67,6 +67,23 @@ namespace Catch { | |||
GeneratorTracker::~GeneratorTracker() {} | |||
} | |||
|
|||
class RedirectedStreams { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this class semantically belongs to include/internal/catch_stream.h
with implementation inside include/internal/catch_stream.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I move the class to catch_output_redirect.h/.cpp instead?
I need to reference the RedirectedStdOut
and RedirectedStdErr
classes from the header file (unfortunately I cannot forward declare them), and these two classes are defined in catch_output_redirect.h (which already #includes catch_stream.h), so I want to avoid the circular include dependency. Plus the class is not really a stream, more a form of output redirection. I could rename the class to something like RedirectOutputToStrings
if it's clearer.
Okay, looks good. |
Thanks |
No problem. Thanks to you too Martin for maintaining this library. |
Description
Fixes issue where the output of a failing test is not redirected to the reporter (but only when
CATCH_CONFIG_EXPERIMENTAL_REDIRECT
is not defined).The issue is caused by
invokeActiveTestCase()
throwing an exception when the test fails, so the next lines aren't ran. I fixed the error by transferring this code to the destructor of the RAII-style classRedirectedStreams
so that it is ran even when an exception occurs.GitHub Issues
Closes issue #1514 (the output of failing tests is not redirected to the junit reporter)
#1514