diff options
| author | Martin Hořeňovský | 2020-05-10 16:44:27 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-05-10 20:20:52 +0200 |
| commit | ed967fd7fcb0f1d995d11ebf1d7d4106d582d43c (patch) | |
| tree | 158f20386c33958c08290e8e37a79875b03307a6 /src/catch2 | |
| parent | 7030d7740d4d576149d5afb31b2f7668d02f8bdc (diff) | |
| download | catch3-ed967fd7fcb0f1d995d11ebf1d7d4106d582d43c.tar.gz | |
Split MessageInfo into its own header
This is first step towards splitting apart reporter implementation
and `catch_string.hpp`.
Diffstat (limited to 'src/catch2')
| -rw-r--r-- | src/catch2/catch_all.hpp | 1 | ||||
| -rw-r--r-- | src/catch2/catch_message.cpp | 21 | ||||
| -rw-r--r-- | src/catch2/catch_message.hpp | 18 | ||||
| -rw-r--r-- | src/catch2/interfaces/catch_interfaces_reporter.cpp | 1 | ||||
| -rw-r--r-- | src/catch2/interfaces/catch_interfaces_reporter.hpp | 2 | ||||
| -rw-r--r-- | src/catch2/internal/catch_message_info.cpp | 26 | ||||
| -rw-r--r-- | src/catch2/internal/catch_message_info.hpp | 31 | ||||
| -rw-r--r-- | src/catch2/internal/catch_run_context.hpp | 1 |
8 files changed, 62 insertions, 39 deletions
diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp index c3f35500..e39204aa 100644 --- a/src/catch2/catch_all.hpp +++ b/src/catch2/catch_all.hpp @@ -56,6 +56,7 @@ #include <catch2/internal/catch_fatal_condition_handler.hpp> #include <catch2/internal/catch_leak_detector.hpp> #include <catch2/internal/catch_list.hpp> +#include <catch2/internal/catch_message_info.hpp> #include <catch2/internal/catch_meta.hpp> #include <catch2/internal/catch_option.hpp> #include <catch2/internal/catch_output_redirect.hpp> diff --git a/src/catch2/catch_message.cpp b/src/catch2/catch_message.cpp index 08207ee7..3d66a5f4 100644 --- a/src/catch2/catch_message.cpp +++ b/src/catch2/catch_message.cpp @@ -16,27 +16,6 @@ namespace Catch { - MessageInfo::MessageInfo( StringRef const& _macroName, - SourceLineInfo const& _lineInfo, - ResultWas::OfType _type ) - : macroName( _macroName ), - lineInfo( _lineInfo ), - type( _type ), - sequence( ++globalCount ) - {} - - bool MessageInfo::operator==( MessageInfo const& other ) const { - return sequence == other.sequence; - } - - bool MessageInfo::operator<( MessageInfo const& other ) const { - return sequence < other.sequence; - } - - // This may need protecting if threading support is added - unsigned int MessageInfo::globalCount = 0; - - //////////////////////////////////////////////////////////////////////////// Catch::MessageBuilder::MessageBuilder( StringRef const& macroName, diff --git a/src/catch2/catch_message.hpp b/src/catch2/catch_message.hpp index 07c99bb0..26b314dd 100644 --- a/src/catch2/catch_message.hpp +++ b/src/catch2/catch_message.hpp @@ -11,6 +11,7 @@ #include <catch2/internal/catch_result_type.hpp> #include <catch2/internal/catch_common.hpp> #include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_message_info.hpp> #include <catch2/interfaces/catch_interfaces_capture.hpp> #include <catch2/catch_tostring.hpp> @@ -19,23 +20,6 @@ namespace Catch { - struct MessageInfo { - MessageInfo( StringRef const& _macroName, - SourceLineInfo const& _lineInfo, - ResultWas::OfType _type ); - - StringRef macroName; - std::string message; - SourceLineInfo lineInfo; - ResultWas::OfType type; - unsigned int sequence; - - bool operator == ( MessageInfo const& other ) const; - bool operator < ( MessageInfo const& other ) const; - private: - static unsigned int globalCount; - }; - struct MessageStream { template<typename T> diff --git a/src/catch2/interfaces/catch_interfaces_reporter.cpp b/src/catch2/interfaces/catch_interfaces_reporter.cpp index 7e538d38..f0e612e7 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.cpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.cpp @@ -7,6 +7,7 @@ #include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/internal/catch_console_colour.hpp> +#include <catch2/catch_message.hpp> #include <catch2/internal/catch_list.hpp> #include <catch2/internal/catch_text.hpp> #include <catch2/internal/catch_string_manip.hpp> diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp index df47ef5c..01469999 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.hpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp @@ -14,7 +14,7 @@ #include <catch2/catch_totals.hpp> #include <catch2/catch_test_case_info.hpp> #include <catch2/catch_assertion_result.hpp> -#include <catch2/catch_message.hpp> +#include <catch2/internal/catch_message_info.hpp> #include <catch2/internal/catch_option.hpp> #include <catch2/internal/catch_stringref.hpp> diff --git a/src/catch2/internal/catch_message_info.cpp b/src/catch2/internal/catch_message_info.cpp new file mode 100644 index 00000000..65d990ad --- /dev/null +++ b/src/catch2/internal/catch_message_info.cpp @@ -0,0 +1,26 @@ + +#include <catch2/internal/catch_message_info.hpp> + +namespace Catch { + + MessageInfo::MessageInfo( StringRef const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ) + : macroName( _macroName ), + lineInfo( _lineInfo ), + type( _type ), + sequence( ++globalCount ) + {} + + bool MessageInfo::operator==( MessageInfo const& other ) const { + return sequence == other.sequence; + } + + bool MessageInfo::operator<( MessageInfo const& other ) const { + return sequence < other.sequence; + } + + // This may need protecting if threading support is added + unsigned int MessageInfo::globalCount = 0; + +} // end namespace Catch diff --git a/src/catch2/internal/catch_message_info.hpp b/src/catch2/internal/catch_message_info.hpp new file mode 100644 index 00000000..b1af4565 --- /dev/null +++ b/src/catch2/internal/catch_message_info.hpp @@ -0,0 +1,31 @@ +#ifndef CATCH_MESSAGE_INFO_HPP_INCLUDED +#define CATCH_MESSAGE_INFO_HPP_INCLUDED + +#include <catch2/internal/catch_result_type.hpp> +#include <catch2/internal/catch_common.hpp> +#include <catch2/interfaces/catch_interfaces_capture.hpp> + +#include <string> + +namespace Catch { + + struct MessageInfo { + MessageInfo( StringRef const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ); + + StringRef macroName; + std::string message; + SourceLineInfo lineInfo; + ResultWas::OfType type; + unsigned int sequence; + + bool operator == ( MessageInfo const& other ) const; + bool operator < ( MessageInfo const& other ) const; + private: + static unsigned int globalCount; + }; + +} // end namespace Catch + +#endif // CATCH_MESSAGE_INFO_HPP_INCLUDED diff --git a/src/catch2/internal/catch_run_context.hpp b/src/catch2/internal/catch_run_context.hpp index ea72dde0..bfbd8bcf 100644 --- a/src/catch2/internal/catch_run_context.hpp +++ b/src/catch2/internal/catch_run_context.hpp @@ -16,6 +16,7 @@ #include <catch2/internal/catch_test_registry.hpp> #include <catch2/catch_test_case_info.hpp> #include <catch2/internal/catch_test_macro_impl.hpp> +#include <catch2/catch_message.hpp> #include <catch2/catch_totals.hpp> #include <catch2/catch_test_spec.hpp> #include <catch2/internal/catch_test_case_tracker.hpp> |