mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Pass around the test suite name by StringRef
This commit is contained in:
		@@ -65,7 +65,7 @@ namespace Catch {
 | 
				
			|||||||
    // IConfig interface
 | 
					    // IConfig interface
 | 
				
			||||||
    bool Config::allowThrows() const                   { return !m_data.noThrow; }
 | 
					    bool Config::allowThrows() const                   { return !m_data.noThrow; }
 | 
				
			||||||
    std::ostream& Config::stream() const               { return m_stream->stream(); }
 | 
					    std::ostream& Config::stream() const               { return m_stream->stream(); }
 | 
				
			||||||
    std::string Config::name() const                   { return m_data.name.empty() ? m_data.processName : m_data.name; }
 | 
					    StringRef Config::name() const                     { return m_data.name.empty() ? m_data.processName : m_data.name; }
 | 
				
			||||||
    bool Config::includeSuccessfulResults() const      { return m_data.showSuccessfulTests; }
 | 
					    bool Config::includeSuccessfulResults() const      { return m_data.showSuccessfulTests; }
 | 
				
			||||||
    bool Config::warnAboutMissingAssertions() const    { return !!(m_data.warnings & WarnAbout::NoAssertions); }
 | 
					    bool Config::warnAboutMissingAssertions() const    { return !!(m_data.warnings & WarnAbout::NoAssertions); }
 | 
				
			||||||
    bool Config::warnAboutNoTests() const              { return !!(m_data.warnings & WarnAbout::NoTests); }
 | 
					    bool Config::warnAboutNoTests() const              { return !!(m_data.warnings & WarnAbout::NoTests); }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -89,7 +89,7 @@ namespace Catch {
 | 
				
			|||||||
        // IConfig interface
 | 
					        // IConfig interface
 | 
				
			||||||
        bool allowThrows() const override;
 | 
					        bool allowThrows() const override;
 | 
				
			||||||
        std::ostream& stream() const override;
 | 
					        std::ostream& stream() const override;
 | 
				
			||||||
        std::string name() const override;
 | 
					        StringRef name() const override;
 | 
				
			||||||
        bool includeSuccessfulResults() const override;
 | 
					        bool includeSuccessfulResults() const override;
 | 
				
			||||||
        bool warnAboutMissingAssertions() const override;
 | 
					        bool warnAboutMissingAssertions() const override;
 | 
				
			||||||
        bool warnAboutNoTests() const override;
 | 
					        bool warnAboutNoTests() const override;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,6 +9,7 @@
 | 
				
			|||||||
#define CATCH_INTERFACES_CONFIG_HPP_INCLUDED
 | 
					#define CATCH_INTERFACES_CONFIG_HPP_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <catch2/internal/catch_noncopyable.hpp>
 | 
					#include <catch2/internal/catch_noncopyable.hpp>
 | 
				
			||||||
 | 
					#include <catch2/internal/catch_stringref.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <chrono>
 | 
					#include <chrono>
 | 
				
			||||||
#include <iosfwd>
 | 
					#include <iosfwd>
 | 
				
			||||||
@@ -59,7 +60,7 @@ namespace Catch {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        virtual bool allowThrows() const = 0;
 | 
					        virtual bool allowThrows() const = 0;
 | 
				
			||||||
        virtual std::ostream& stream() const = 0;
 | 
					        virtual std::ostream& stream() const = 0;
 | 
				
			||||||
        virtual std::string name() const = 0;
 | 
					        virtual StringRef name() const = 0;
 | 
				
			||||||
        virtual bool includeSuccessfulResults() const = 0;
 | 
					        virtual bool includeSuccessfulResults() const = 0;
 | 
				
			||||||
        virtual bool shouldDebugBreak() const = 0;
 | 
					        virtual bool shouldDebugBreak() const = 0;
 | 
				
			||||||
        virtual bool warnAboutMissingAssertions() const = 0;
 | 
					        virtual bool warnAboutMissingAssertions() const = 0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,9 +29,6 @@ namespace Catch {
 | 
				
			|||||||
    std::ostream& ReporterConfig::stream() const { return *m_stream; }
 | 
					    std::ostream& ReporterConfig::stream() const { return *m_stream; }
 | 
				
			||||||
    IConfig const * ReporterConfig::fullConfig() const { return m_fullConfig; }
 | 
					    IConfig const * ReporterConfig::fullConfig() const { return m_fullConfig; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
 | 
					    AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
 | 
				
			||||||
                                    std::vector<MessageInfo> const& _infoMessages,
 | 
					                                    std::vector<MessageInfo> const& _infoMessages,
 | 
				
			||||||
                                    Totals const& _totals )
 | 
					                                    Totals const& _totals )
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,8 +45,8 @@ namespace Catch {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct TestRunInfo {
 | 
					    struct TestRunInfo {
 | 
				
			||||||
        TestRunInfo( std::string const& _name );
 | 
					        TestRunInfo(StringRef _name) : name(_name) {}
 | 
				
			||||||
        std::string name;
 | 
					        StringRef name;
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct AssertionStats {
 | 
					    struct AssertionStats {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,8 +31,8 @@ namespace Catch {
 | 
				
			|||||||
                  .initialIndent(indent) << '\n';
 | 
					                  .initialIndent(indent) << '\n';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        std::string escape(std::string const& str) {
 | 
					        std::string escape(StringRef str) {
 | 
				
			||||||
            std::string escaped = str;
 | 
					            std::string escaped = static_cast<std::string>(str);
 | 
				
			||||||
            replaceInPlace(escaped, "|", "||");
 | 
					            replaceInPlace(escaped, "|", "||");
 | 
				
			||||||
            replaceInPlace(escaped, "'", "|'");
 | 
					            replaceInPlace(escaped, "'", "|'");
 | 
				
			||||||
            replaceInPlace(escaped, "\n", "|n");
 | 
					            replaceInPlace(escaped, "\n", "|n");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user