catch2/include/internal
Martin Hořeňovský e92b9c07c3 Add an experimental new way of capturing stdout/stderr
Unlike the relatively non-invasive old way of capturing stdout/stderr,
this new way is also able to capture output from C's stdlib functions
such as `printf`. This is done by redirecting stdout and stderr file
descriptors to a file, and then reading this file back.

This approach has two sizeable drawbacks:
1) Performance, obviously. Previously an installed capture made the
program run faster (as long as it was then discarded), because a call
to `std::cout` did not result in text output to the console. This new
capture method in fact forces disk IO. While it is likely that any
modern OS will keep this file in memory-cache and might never actually
issue the IO to the backing storage, it is still a possibility and
calls to the file system are not free.

2) Nonportability. While POSIX is usually assumed portable, and this
implementation relies only on a very common parts of it, it is no
longer standard C++ (or just plain C) and thus might not be available
on some obscure platforms. Different C libs might also implement the
relevant functions in a less-than-useful ways (e.g. MS's `tmpfile`
generates a temp file inside system folder, so it will not work
without elevated privileges and thus is useless).

These two drawbacks mean that, at least for now, the new capture is
opt-in. To opt-in, `CATCH_CONFIG_EXPERIMENTAL_REDIRECT` needs to be
defined in the implementation file.

Closes #1243
2018-04-29 22:25:49 +02:00
..
catch_approx.cpp Introduced ReusableStringStream and removed all uses of std::ostringstream from the main path 2017-11-07 18:01:10 +00:00
catch_approx.h Introduced ReusableStringStream and removed all uses of std::ostringstream from the main path 2017-11-07 18:01:10 +00:00
catch_assertionhandler.cpp Fix a7a9ee5 2017-12-09 20:49:06 +01:00
catch_assertionhandler.h Fix a7a9ee5 2017-12-09 20:49:06 +01:00
catch_assertioninfo.h Actually do what the previous commit claimed to do! 2017-08-09 10:29:05 +01:00
catch_assertionresult.cpp StringRef appends itself to std::string efficiently 2018-02-28 16:02:25 +01:00
catch_assertionresult.h Fix pointless type mismatch between StringRef and std::string 2017-11-13 12:49:13 +01:00
catch_benchmark.cpp Remove catch_context.h from the common include path 2017-08-29 15:36:09 +02:00
catch_benchmark.h qualified a load of size_ts with std:: namespace (all those not from Clara) 2017-09-18 17:13:17 +01:00
catch_capture_matchers.cpp Fixup various spelling errors (#1208) 2018-03-07 10:08:35 +01:00
catch_capture_matchers.h Add PredicateMatcher that takes an arbitrary predicate functions 2018-04-04 11:14:19 +02:00
catch_capture.hpp Some bits of tidy up 2017-12-07 00:02:32 +00:00
catch_clara.h Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_commandline.cpp Allow only 1 reporter at a time 2018-04-07 12:05:29 +02:00
catch_commandline.h Changed all .hpp extensions to .h where there is now a corresponding .cpp 2017-09-07 11:24:33 +01:00
catch_common.cpp Manual cherry-pick from #1111 2017-12-09 20:17:47 +01:00
catch_common.h Fix a7a9ee5 2017-12-09 20:49:06 +01:00
catch_compiler_capabilities.h Remove superfluous include and fix comment 2018-04-26 21:44:07 +02:00
catch_config.cpp Allow only 1 reporter at a time 2018-04-07 12:05:29 +02:00
catch_config.hpp Call listeners before calling reporters 2018-04-07 12:25:03 +02:00
catch_console_colour.cpp Introduce support for DJGPP cross compiler 2018-03-07 10:35:32 +01:00
catch_console_colour.h Add a BrightYellow colour, also use it for reconstructed exprs 2018-02-01 14:58:33 +00:00
catch_context.cpp Manual cherry-pick from #1111 2017-12-09 20:17:47 +01:00
catch_context.h Manual cherry-pick from #1111 2017-12-09 20:17:47 +01:00
catch_debug_console.cpp Fix how windows.h is included in our files. 2018-02-23 12:40:12 +01:00
catch_debug_console.h Split writeToDebugConsole out of main path 2017-08-29 13:51:55 +02:00
catch_debugger.cpp Moved a lot of stream related stuff out of the public headers and replaced more ostream dependencies with iosfwd 2017-11-07 15:55:09 +00:00
catch_debugger.h Fixes for cygwin 2018-02-01 16:14:20 +00:00
catch_decomposer.cpp Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_decomposer.h Remove unnecessary semicolons 2018-02-05 10:03:51 +01:00
catch_default_main.hpp Introduce conditional wchar_t (and std::wstring) support 2018-03-07 10:35:31 +01:00
catch_enforce.h Removed unnecessary use of ostringstream from catch_enforce.h 2018-02-15 13:59:02 +00:00
catch_errno_guard.cpp Started work on splitting out .cpp files from header files 2017-07-06 22:28:42 +02:00
catch_errno_guard.h Started work on splitting out .cpp files from header files 2017-07-06 22:28:42 +02:00
catch_exception_translator_registry.cpp Guard against CLR exceptions when translating exceptions 2018-01-24 12:11:29 +01:00
catch_exception_translator_registry.h Addressed Resharper-C++ warnings 2017-07-25 17:16:28 +02:00
catch_external_interfaces.h Provide ConsoleReporter declaration with EXTERNAL_INTERFACES 2017-11-14 20:42:58 +01:00
catch_fatal_condition.cpp Fix 'defined but not used' warning 2018-03-01 13:37:23 +01:00
catch_fatal_condition.h Simplify logic selecting between signal handling/SEH/nothing 2018-02-23 14:56:07 +01:00
catch_impl.hpp Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_interfaces_capture.cpp Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_interfaces_capture.h Revirtualised IResultCapture methods 2017-12-05 16:23:10 +00:00
catch_interfaces_config.cpp Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_interfaces_config.h https://github.com/catchorg/Catch2/issues/1175 - don't list hidden tests by default 2018-02-09 19:55:40 +01:00
catch_interfaces_exception.cpp Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_interfaces_exception.h Stop leaking some warning suppressions to user code 2017-11-29 19:14:33 +03:00
catch_interfaces_registry_hub.cpp Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_interfaces_registry_hub.h Move std::exception_ptr out of interfaces 2017-07-27 12:24:52 +02:00
catch_interfaces_reporter.cpp Call listeners before calling reporters 2018-04-07 12:25:03 +02:00
catch_interfaces_reporter.h Call listeners before calling reporters 2018-04-07 12:25:03 +02:00
catch_interfaces_runner.cpp Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_interfaces_runner.h Minor cleanup 2017-08-30 15:53:39 +02:00
catch_interfaces_tag_alias_registry.h Split Option<T> and TagAlias definitions away from the main include path 2017-07-27 11:55:30 +02:00
catch_interfaces_testcase.cpp Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_interfaces_testcase.h Changed some names in test case registry 2017-07-12 23:11:41 +01:00
catch_leak_detector.cpp Move crtdbg.h include outside namespace 2017-11-24 10:36:54 +00:00
catch_leak_detector.h Moved leak detector to its own file 2017-07-12 15:03:52 +02:00
catch_list.cpp https://github.com/catchorg/Catch2/issues/1175 - don't list hidden tests by default 2018-02-09 19:55:40 +01:00
catch_list.h Remove <set> include from the common test path 2017-07-27 22:31:27 +02:00
catch_matchers_floating.cpp Fix bug in WithinAbs::match() and add tests for it 2018-03-21 13:47:12 +01:00
catch_matchers_floating.h Remove leftover commented out lines 2017-11-10 18:37:58 +01:00
catch_matchers_generic.cpp Add PredicateMatcher that takes an arbitrary predicate functions 2018-04-04 11:14:19 +02:00
catch_matchers_generic.hpp Add PredicateMatcher that takes an arbitrary predicate functions 2018-04-04 11:14:19 +02:00
catch_matchers_string.cpp Provide a regex matcher against std::string 2017-11-13 15:35:31 +01:00
catch_matchers_string.h Provide a regex matcher against std::string 2017-11-13 15:35:31 +01:00
catch_matchers_vector.h Add UnorderedEqualsMatcher for vectors 2017-12-07 19:05:00 +01:00
catch_matchers.cpp Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_matchers.h Removed vestigal ComparatorT template arg to MatcherBase 2017-11-13 10:08:48 +00:00
catch_message.cpp Redirect std::uncaught_exception to Catch::uncaught_exception 2018-02-02 15:36:15 +01:00
catch_message.h Some bits of tidy up 2017-12-07 00:02:32 +00:00
catch_objc_arc.hpp Conditionally compile clang pragmas 2012-08-16 18:47:41 +01:00
catch_objc.hpp qualified a load of size_ts with std:: namespace (all those not from Clara) 2017-09-18 17:13:17 +01:00
catch_option.hpp General cleanup 2017-07-27 11:32:01 +02:00
catch_output_redirect.cpp Add an experimental new way of capturing stdout/stderr 2018-04-29 22:25:49 +02:00
catch_output_redirect.h Add an experimental new way of capturing stdout/stderr 2018-04-29 22:25:49 +02:00
catch_platform.h Detect MinGW as Windows platform w/o SEH 2018-04-22 18:46:54 +02:00
catch_random_number_generator.cpp enclosed more min/ max in parentheses to default MFC macros 2017-10-13 13:46:39 +01:00
catch_random_number_generator.h Remove self-include in header 2017-11-03 22:34:49 +01:00
catch_reenable_warnings.h Suppress warnings correctly for Intel compiler 2015-03-04 07:54:35 +00:00
catch_registry_hub.cpp Clean-up re-usable string streams 2017-11-24 08:46:17 +00:00
catch_reporter_registrars.hpp Some bits of tidy up 2017-12-07 00:02:32 +00:00
catch_reporter_registry.cpp Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_reporter_registry.h Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_result_type.cpp Manual cherry-pick from #1111 2017-12-09 20:17:47 +01:00
catch_result_type.h Manual cherry-pick from #1111 2017-12-09 20:17:47 +01:00
catch_run_context.cpp Add an experimental new way of capturing stdout/stderr 2018-04-29 22:25:49 +02:00
catch_run_context.h Fix clang-tidy 6 diagnostic about virtual call in destructor 2018-03-21 17:05:15 +01:00
catch_section_info.cpp Move Section(End)Info bodies to proper .cpp file 2017-08-01 17:51:32 +02:00
catch_section_info.h Changed all .hpp extensions to .h where there is now a corresponding .cpp 2017-09-07 11:24:33 +01:00
catch_section.cpp Redirect std::uncaught_exception to Catch::uncaught_exception 2018-02-02 15:36:15 +01:00
catch_section.h Changed all .hpp extensions to .h where there is now a corresponding .cpp 2017-09-07 11:24:33 +01:00
catch_session.cpp Call listeners before calling reporters 2018-04-07 12:25:03 +02:00
catch_session.h Merge branch 'master' into master 2018-03-07 10:37:50 +01:00
catch_startup_exception_registry.cpp Made everything used in test case registration noexcept 2017-07-13 08:25:47 +01:00
catch_startup_exception_registry.h Made everything used in test case registration noexcept 2017-07-13 08:25:47 +01:00
catch_stream.cpp Clean-up re-usable string streams 2017-11-24 08:46:17 +00:00
catch_stream.h Clean-up re-usable string streams 2017-11-24 08:46:17 +00:00
catch_string_manip.cpp Split out helper functions on std::string from catch_common.h 2017-07-25 21:57:35 +02:00
catch_string_manip.h Split out helper functions on std::string from catch_common.h 2017-07-25 21:57:35 +02:00
catch_stringref.cpp Provide a public method to get StringRef's underlying pointer 2018-02-28 22:49:00 +01:00
catch_stringref.h Provide a public method to get StringRef's underlying pointer 2018-02-28 22:49:00 +01:00
catch_suppress_warnings.h Leak less GCC warnings suppressions out of Catch 2018-04-01 13:57:05 +02:00
catch_tag_alias_autoregistrar.cpp Move std::exception_ptr out of interfaces 2017-07-27 12:24:52 +02:00
catch_tag_alias_autoregistrar.h Stop leaking some warning suppressions to user code 2017-11-29 19:14:33 +03:00
catch_tag_alias_registry.cpp Introduced ReusableStringStream and removed all uses of std::ostringstream from the main path 2017-11-07 18:01:10 +00:00
catch_tag_alias_registry.h Split Option<T> and TagAlias definitions away from the main include path 2017-07-27 11:55:30 +02:00
catch_tag_alias.cpp Split Option<T> and TagAlias definitions away from the main include path 2017-07-27 11:55:30 +02:00
catch_tag_alias.h Split Option<T> and TagAlias definitions away from the main include path 2017-07-27 11:55:30 +02:00
catch_test_case_info.cpp Cast to unsigned char when using std::isalnum 2018-04-29 20:28:35 +02:00
catch_test_case_info.h Cleanup for performance reasons 2018-03-02 16:24:35 +01:00
catch_test_case_registry_impl.cpp Cleanup for performance reasons 2018-03-02 16:24:35 +01:00
catch_test_case_registry_impl.h Cleanup for performance reasons 2018-03-02 16:24:35 +01:00
catch_test_case_tracker.cpp Changed to c++ style includes 2018-04-21 15:58:05 +02:00
catch_test_case_tracker.h Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_test_registry.cpp Cleanup for performance reasons 2018-03-02 16:24:35 +01:00
catch_test_registry.h Support for parenthesizing types with commas. 2018-04-20 15:11:09 +02:00
catch_test_spec_parser.cpp Changed all .hpp extensions to .h where there is now a corresponding .cpp 2017-09-07 11:24:33 +01:00
catch_test_spec_parser.h qualified a load of size_ts with std:: namespace (all those not from Clara) 2017-09-18 17:13:17 +01:00
catch_test_spec.cpp Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_test_spec.h Sweep out some extra warnings 2017-09-07 17:25:15 +02:00
catch_text.h Removed tbc_text_format (superceded by TextFlow) 2017-07-20 23:20:42 +01:00
catch_timer.cpp Add an early bailout out of benchmark timer calibration 2018-04-01 22:50:39 +02:00
catch_timer.h Increased int size for timers to avoid truncations 2017-12-08 15:59:00 +00:00
catch_tostring.cpp Introduce conditional wchar_t (and std::wstring) support 2018-03-07 10:35:31 +01:00
catch_tostring.h Fix stringifying static array of unsigned chars 2018-04-06 11:43:12 +02:00
catch_totals.cpp Changed all .hpp extensions to .h where there is now a corresponding .cpp 2017-09-07 11:24:33 +01:00
catch_totals.h Add option to warn when no tests ran 2018-02-09 18:49:36 +01:00
catch_uncaught_exceptions.cpp Remove superfluous comment 2018-02-08 13:09:02 +01:00
catch_uncaught_exceptions.h Redirect std::uncaught_exception to Catch::uncaught_exception 2018-02-02 15:36:15 +01:00
catch_user_interfaces.h Introduce a way to intentionally expose interface for use in tests 2017-11-21 11:10:07 +01:00
catch_version.cpp v2.2.2 2018-04-06 12:11:22 +02:00
catch_version.h Address results of PVS-Studio static analysis 2017-07-20 00:27:28 +02:00
catch_wildcard_pattern.cpp Introduced ReusableStringStream and removed all uses of std::ostringstream from the main path 2017-11-07 18:01:10 +00:00
catch_wildcard_pattern.h Changed all .hpp extensions to .h where there is now a corresponding .cpp 2017-09-07 11:24:33 +01:00
catch_windows_h_proxy.h unconditional windows proxy 2017-10-11 14:58:20 +01:00
catch_xmlwriter.cpp Modify XML encoder to hex-encode invalid UTF-8 sequences 2018-03-27 16:49:14 +02:00
catch_xmlwriter.h Modify XML encoder to hex-encode invalid UTF-8 sequences 2018-03-27 16:49:14 +02:00