Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorChris Thrasher2025-09-21 18:05:21 -0600
committerChris Thrasher2025-09-22 11:50:44 -0600
commit8efee9b7632e6dd014b5b041ee326eef7d0b09e6 (patch)
treefbc1657a5d7d414fbe93a412990bcf5cfb2df438 /src
parenta5735af2f7d956600250541d289c552ace7e87ae (diff)
downloadcatch3-devel-c++17.tar.gz
Use std::string_viewdevel-c++17
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/catch2/catch_all.hpp1
-rw-r--r--src/catch2/catch_assertion_info.hpp7
-rw-r--r--src/catch2/catch_assertion_result.cpp4
-rw-r--r--src/catch2/catch_assertion_result.hpp5
-rw-r--r--src/catch2/catch_config.cpp3
-rw-r--r--src/catch2/catch_config.hpp3
-rw-r--r--src/catch2/catch_message.cpp8
-rw-r--r--src/catch2/catch_message.hpp14
-rw-r--r--src/catch2/catch_section_info.hpp1
-rw-r--r--src/catch2/catch_test_case_info.cpp37
-rw-r--r--src/catch2/catch_test_case_info.hpp14
-rw-r--r--src/catch2/catch_test_run_info.hpp6
-rw-r--r--src/catch2/catch_tostring.cpp6
-rw-r--r--src/catch2/catch_tostring.hpp12
-rw-r--r--src/catch2/generators/catch_generators.cpp4
-rw-r--r--src/catch2/generators/catch_generators.hpp9
-rw-r--r--src/catch2/interfaces/catch_interfaces_capture.hpp13
-rw-r--r--src/catch2/interfaces/catch_interfaces_config.hpp3
-rw-r--r--src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp13
-rw-r--r--src/catch2/interfaces/catch_interfaces_generatortracker.cpp2
-rw-r--r--src/catch2/interfaces/catch_interfaces_generatortracker.hpp3
-rw-r--r--src/catch2/interfaces/catch_interfaces_reporter.hpp11
-rw-r--r--src/catch2/interfaces/catch_interfaces_reporter_factory.hpp3
-rw-r--r--src/catch2/internal/catch_assertion_handler.cpp4
-rw-r--r--src/catch2/internal/catch_assertion_handler.hpp4
-rw-r--r--src/catch2/internal/catch_case_insensitive_comparisons.cpp8
-rw-r--r--src/catch2/internal/catch_case_insensitive_comparisons.hpp10
-rw-r--r--src/catch2/internal/catch_clara.cpp20
-rw-r--r--src/catch2/internal/catch_clara.hpp45
-rw-r--r--src/catch2/internal/catch_decomposer.cpp2
-rw-r--r--src/catch2/internal/catch_decomposer.hpp27
-rw-r--r--src/catch2/internal/catch_enum_values_registry.cpp15
-rw-r--r--src/catch2/internal/catch_enum_values_registry.hpp7
-rw-r--r--src/catch2/internal/catch_jsonwriter.cpp24
-rw-r--r--src/catch2/internal/catch_jsonwriter.hpp9
-rw-r--r--src/catch2/internal/catch_list.cpp4
-rw-r--r--src/catch2/internal/catch_list.hpp9
-rw-r--r--src/catch2/internal/catch_message_info.cpp2
-rw-r--r--src/catch2/internal/catch_message_info.hpp5
-rw-r--r--src/catch2/internal/catch_preprocessor.hpp8
-rw-r--r--src/catch2/internal/catch_preprocessor_internal_stringify.hpp4
-rw-r--r--src/catch2/internal/catch_reporter_spec_parser.cpp24
-rw-r--r--src/catch2/internal/catch_reporter_spec_parser.hpp7
-rw-r--r--src/catch2/internal/catch_run_context.cpp16
-rw-r--r--src/catch2/internal/catch_run_context.hpp12
-rw-r--r--src/catch2/internal/catch_section.cpp2
-rw-r--r--src/catch2/internal/catch_section.hpp4
-rw-r--r--src/catch2/internal/catch_stream_end_stop.hpp4
-rw-r--r--src/catch2/internal/catch_string_manip.cpp24
-rw-r--r--src/catch2/internal/catch_string_manip.hpp25
-rw-r--r--src/catch2/internal/catch_stringref.cpp65
-rw-r--r--src/catch2/internal/catch_stringref.hpp123
-rw-r--r--src/catch2/internal/catch_template_test_registry.hpp6
-rw-r--r--src/catch2/internal/catch_test_case_tracker.cpp10
-rw-r--r--src/catch2/internal/catch_test_case_tracker.hpp18
-rw-r--r--src/catch2/internal/catch_test_macro_impl.hpp11
-rw-r--r--src/catch2/internal/catch_test_registry.cpp4
-rw-r--r--src/catch2/internal/catch_test_registry.hpp29
-rw-r--r--src/catch2/internal/catch_xmlwriter.cpp34
-rw-r--r--src/catch2/internal/catch_xmlwriter.hpp32
-rw-r--r--src/catch2/matchers/catch_matchers_string.cpp16
-rw-r--r--src/catch2/matchers/catch_matchers_string.hpp8
-rw-r--r--src/catch2/matchers/catch_matchers_templated.cpp2
-rw-r--r--src/catch2/matchers/catch_matchers_templated.hpp10
-rw-r--r--src/catch2/matchers/internal/catch_matchers_impl.hpp4
-rw-r--r--src/catch2/meson.build2
-rw-r--r--src/catch2/reporters/catch_reporter_compact.cpp24
-rw-r--r--src/catch2/reporters/catch_reporter_compact.hpp2
-rw-r--r--src/catch2/reporters/catch_reporter_console.cpp76
-rw-r--r--src/catch2/reporters/catch_reporter_console.hpp8
-rw-r--r--src/catch2/reporters/catch_reporter_cumulative_base.hpp10
-rw-r--r--src/catch2/reporters/catch_reporter_event_listener.cpp10
-rw-r--r--src/catch2/reporters/catch_reporter_event_listener.hpp10
-rw-r--r--src/catch2/reporters/catch_reporter_helpers.cpp16
-rw-r--r--src/catch2/reporters/catch_reporter_json.cpp116
-rw-r--r--src/catch2/reporters/catch_reporter_json.hpp8
-rw-r--r--src/catch2/reporters/catch_reporter_junit.cpp42
-rw-r--r--src/catch2/reporters/catch_reporter_multi.cpp10
-rw-r--r--src/catch2/reporters/catch_reporter_multi.hpp10
-rw-r--r--src/catch2/reporters/catch_reporter_registrars.hpp10
-rw-r--r--src/catch2/reporters/catch_reporter_sonarqube.cpp14
-rw-r--r--src/catch2/reporters/catch_reporter_sonarqube.hpp2
-rw-r--r--src/catch2/reporters/catch_reporter_streaming_base.hpp12
-rw-r--r--src/catch2/reporters/catch_reporter_tap.cpp28
-rw-r--r--src/catch2/reporters/catch_reporter_tap.hpp2
-rw-r--r--src/catch2/reporters/catch_reporter_teamcity.cpp2
-rw-r--r--src/catch2/reporters/catch_reporter_xml.cpp106
-rw-r--r--src/catch2/reporters/catch_reporter_xml.hpp4
89 files changed, 595 insertions, 810 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1b5a7a8b..7c29add5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -124,7 +124,6 @@ set(IMPL_HEADERS
${SOURCES_DIR}/internal/catch_stdstreams.hpp
${SOURCES_DIR}/internal/catch_stream_end_stop.hpp
${SOURCES_DIR}/internal/catch_string_manip.hpp
- ${SOURCES_DIR}/internal/catch_stringref.hpp
${SOURCES_DIR}/internal/catch_tag_alias_registry.hpp
${SOURCES_DIR}/internal/catch_template_test_registry.hpp
${SOURCES_DIR}/internal/catch_test_case_info_hasher.hpp
@@ -201,7 +200,6 @@ set(IMPL_SOURCES
${SOURCES_DIR}/internal/catch_startup_exception_registry.cpp
${SOURCES_DIR}/internal/catch_stdstreams.cpp
${SOURCES_DIR}/internal/catch_string_manip.cpp
- ${SOURCES_DIR}/internal/catch_stringref.cpp
${SOURCES_DIR}/internal/catch_tag_alias_registry.cpp
${SOURCES_DIR}/internal/catch_test_case_info_hasher.cpp
${SOURCES_DIR}/internal/catch_test_case_registry_impl.cpp
diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp
index 4c9ea994..d948e126 100644
--- a/src/catch2/catch_all.hpp
+++ b/src/catch2/catch_all.hpp
@@ -106,7 +106,6 @@
#include <catch2/internal/catch_stdstreams.hpp>
#include <catch2/internal/catch_stream_end_stop.hpp>
#include <catch2/internal/catch_string_manip.hpp>
-#include <catch2/internal/catch_stringref.hpp>
#include <catch2/internal/catch_tag_alias_registry.hpp>
#include <catch2/internal/catch_template_test_registry.hpp>
#include <catch2/internal/catch_test_case_info_hasher.hpp>
diff --git a/src/catch2/catch_assertion_info.hpp b/src/catch2/catch_assertion_info.hpp
index 9d2f91fa..b64ad74b 100644
--- a/src/catch2/catch_assertion_info.hpp
+++ b/src/catch2/catch_assertion_info.hpp
@@ -10,16 +10,17 @@
#include <catch2/internal/catch_result_type.hpp>
#include <catch2/internal/catch_source_line_info.hpp>
-#include <catch2/internal/catch_stringref.hpp>
+
+#include <string_view>
namespace Catch {
struct AssertionInfo {
// AssertionInfo() = delete;
- StringRef macroName;
+ std::string_view macroName;
SourceLineInfo lineInfo;
- StringRef capturedExpression;
+ std::string_view capturedExpression;
ResultDisposition::Flags resultDisposition;
};
diff --git a/src/catch2/catch_assertion_result.cpp b/src/catch2/catch_assertion_result.cpp
index dba86229..6fa33bf5 100644
--- a/src/catch2/catch_assertion_result.cpp
+++ b/src/catch2/catch_assertion_result.cpp
@@ -91,14 +91,14 @@ namespace Catch {
: expr;
}
- StringRef AssertionResult::getMessage() const {
+ std::string_view AssertionResult::getMessage() const {
return m_resultData.message;
}
SourceLineInfo AssertionResult::getSourceInfo() const {
return m_info.lineInfo;
}
- StringRef AssertionResult::getTestMacroName() const {
+ std::string_view AssertionResult::getTestMacroName() const {
return m_info.macroName;
}
diff --git a/src/catch2/catch_assertion_result.hpp b/src/catch2/catch_assertion_result.hpp
index 48882876..d3f986e6 100644
--- a/src/catch2/catch_assertion_result.hpp
+++ b/src/catch2/catch_assertion_result.hpp
@@ -11,7 +11,6 @@
#include <catch2/catch_assertion_info.hpp>
#include <catch2/internal/catch_result_type.hpp>
#include <catch2/internal/catch_source_line_info.hpp>
-#include <catch2/internal/catch_stringref.hpp>
#include <catch2/internal/catch_lazy_expr.hpp>
#include <string>
@@ -46,9 +45,9 @@ namespace Catch {
std::string getExpressionInMacro() const;
bool hasExpandedExpression() const;
std::string getExpandedExpression() const;
- StringRef getMessage() const;
+ std::string_view getMessage() const;
SourceLineInfo getSourceInfo() const;
- StringRef getTestMacroName() const;
+ std::string_view getTestMacroName() const;
//protected:
AssertionInfo m_info;
diff --git a/src/catch2/catch_config.cpp b/src/catch2/catch_config.cpp
index 4e5c9e2c..3cb7c474 100644
--- a/src/catch2/catch_config.cpp
+++ b/src/catch2/catch_config.cpp
@@ -10,7 +10,6 @@
#include <catch2/internal/catch_enforce.hpp>
#include <catch2/internal/catch_parse_numbers.hpp>
#include <catch2/internal/catch_stdstreams.hpp>
-#include <catch2/internal/catch_stringref.hpp>
#include <catch2/internal/catch_string_manip.hpp>
#include <catch2/internal/catch_test_spec_parser.hpp>
#include <catch2/interfaces/catch_interfaces_tag_alias_registry.hpp>
@@ -186,7 +185,7 @@ namespace Catch {
// IConfig interface
bool Config::allowThrows() const { return !m_data.noThrow; }
- StringRef Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
+ std::string_view Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; }
bool Config::warnAboutMissingAssertions() const {
return !!( m_data.warnings & WarnAbout::NoAssertions );
diff --git a/src/catch2/catch_config.hpp b/src/catch2/catch_config.hpp
index e22f2d3e..b97ff8a3 100644
--- a/src/catch2/catch_config.hpp
+++ b/src/catch2/catch_config.hpp
@@ -11,7 +11,6 @@
#include <catch2/catch_test_spec.hpp>
#include <catch2/interfaces/catch_interfaces_config.hpp>
#include <catch2/internal/catch_unique_ptr.hpp>
-#include <catch2/internal/catch_stringref.hpp>
#include <catch2/internal/catch_random_seed_generation.hpp>
#include <catch2/internal/catch_reporter_spec_parser.hpp>
@@ -115,7 +114,7 @@ namespace Catch {
// IConfig interface
bool allowThrows() const override;
- StringRef name() const override;
+ std::string_view name() const override;
bool includeSuccessfulResults() const override;
bool warnAboutMissingAssertions() const override;
bool warnAboutUnmatchedTestSpecs() const override;
diff --git a/src/catch2/catch_message.cpp b/src/catch2/catch_message.cpp
index 1ea8c299..074eb930 100644
--- a/src/catch2/catch_message.cpp
+++ b/src/catch2/catch_message.cpp
@@ -35,10 +35,10 @@ namespace Catch {
}
- Capturer::Capturer( StringRef macroName,
+ Capturer::Capturer( std::string_view macroName,
SourceLineInfo const& lineInfo,
ResultWas::OfType resultType,
- StringRef names ):
+ std::string_view names ):
m_resultCapture( getResultCapture() ) {
auto trimmed = [&] (size_t start, size_t end) {
while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) {
@@ -86,7 +86,7 @@ namespace Catch {
if (start != pos && openings.empty()) {
m_messages.emplace_back(macroName, lineInfo, resultType);
m_messages.back().message += trimmed(start, pos);
- m_messages.back().message += " := "_sr;
+ m_messages.back().message += " := ";
start = pos;
}
break;
@@ -96,7 +96,7 @@ namespace Catch {
assert(openings.empty() && "Mismatched openings");
m_messages.emplace_back(macroName, lineInfo, resultType);
m_messages.back().message += trimmed(start, names.size() - 1);
- m_messages.back().message += " := "_sr;
+ m_messages.back().message += " := ";
}
Capturer::~Capturer() {
assert( m_captured == m_messages.size() );
diff --git a/src/catch2/catch_message.hpp b/src/catch2/catch_message.hpp
index db3d682a..9ed66c3e 100644
--- a/src/catch2/catch_message.hpp
+++ b/src/catch2/catch_message.hpp
@@ -36,7 +36,7 @@ namespace Catch {
};
struct MessageBuilder : MessageStream {
- MessageBuilder( StringRef macroName,
+ MessageBuilder( std::string_view macroName,
SourceLineInfo const& lineInfo,
ResultWas::OfType type ):
m_info(macroName, lineInfo, type) {}
@@ -66,7 +66,7 @@ namespace Catch {
IResultCapture& m_resultCapture;
size_t m_captured = 0;
public:
- Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names );
+ Capturer( std::string_view macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, std::string_view names );
Capturer(Capturer const&) = delete;
Capturer& operator=(Capturer const&) = delete;
@@ -92,26 +92,26 @@ namespace Catch {
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \
do { \
- Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::StringRef(), resultDisposition ); \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, std::string_view(), resultDisposition ); \
catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \
catchAssertionHandler.complete(); \
} while( false )
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \
- Catch::Capturer varName( macroName##_catch_sr, \
+ Catch::Capturer varName( macroName, \
CATCH_INTERNAL_LINEINFO, \
Catch::ResultWas::Info, \
- #__VA_ARGS__##_catch_sr ); \
+ #__VA_ARGS__ ); \
varName.captureValues( 0, __VA_ARGS__ )
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_INFO( macroName, log ) \
- const Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )
+ const Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )
///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_UNSCOPED_INFO( macroName, log ) \
- Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )
+ Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )
#if defined(CATCH_CONFIG_PREFIX_MESSAGES) && !defined(CATCH_CONFIG_DISABLE)
diff --git a/src/catch2/catch_section_info.hpp b/src/catch2/catch_section_info.hpp
index 7de8441c..d8cf9341 100644
--- a/src/catch2/catch_section_info.hpp
+++ b/src/catch2/catch_section_info.hpp
@@ -10,7 +10,6 @@
#include <catch2/internal/catch_move_and_forward.hpp>
#include <catch2/internal/catch_source_line_info.hpp>
-#include <catch2/internal/catch_stringref.hpp>
#include <catch2/catch_totals.hpp>
#include <string>
diff --git a/src/catch2/catch_test_case_info.cpp b/src/catch2/catch_test_case_info.cpp
index 9d64e532..407b8673 100644
--- a/