Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Removed default ctors for AssertionInfo, AssertionResult and SourceLineInfo

Commit
5e60050299ace9652c50103b8febbb0e4be67475
Author
Phil Nash ·
Parents
e658bacb04ef

Files · Download .tar.gz

Changes

 include/internal/catch_assertionresult.cpp          | 2 --
 include/internal/catch_assertionresult.h            | 3 +--
 include/internal/catch_common.cpp                   | 1 -
 include/internal/catch_common.h                     | 4 ++--
 include/internal/catch_notimplemented_exception.cpp | 3 +--
 include/internal/catch_notimplemented_exception.h   | 1 -
 include/internal/catch_run_context.cpp              | 8 +++++---
 include/internal/catch_run_context.hpp              | 2 +-
 projects/SelfTest/PartTrackerTests.cpp              | 2 +-
 9 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/include/internal/catch_assertionresult.cpp b/include/internal/catch_assertionresult.cpp
index 9a4b0c65..63c8b22c 100644
--- a/include/internal/catch_assertionresult.cpp
+++ b/include/internal/catch_assertionresult.cpp
@@ -49,8 +49,6 @@ namespace Catch {
         return reconstructedExpression;
     }
 
-    AssertionResult::AssertionResult() {}
-
     AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data )
     :   m_info( info ),
         m_resultData( data )
diff --git a/include/internal/catch_assertionresult.h b/include/internal/catch_assertionresult.h
index 89a96298..eac589c6 100644
--- a/include/internal/catch_assertionresult.h
+++ b/include/internal/catch_assertionresult.h
@@ -39,7 +39,7 @@ namespace Catch {
 
     struct AssertionInfo
     {
-        AssertionInfo() = default;
+        AssertionInfo() = delete;
         AssertionInfo(  char const * _macroName,
                         SourceLineInfo const& _lineInfo,
                         char const * _capturedExpression,
@@ -66,7 +66,6 @@ namespace Catch {
 
     class AssertionResult {
     public:
-        AssertionResult();
         AssertionResult( AssertionInfo const& info, AssertionResultData const& data );
         ~AssertionResult();
 
diff --git a/include/internal/catch_common.cpp b/include/internal/catch_common.cpp
index 753b9487..01c18ba4 100644
--- a/include/internal/catch_common.cpp
+++ b/include/internal/catch_common.cpp
@@ -15,7 +15,6 @@
 
 namespace Catch {
 
-    SourceLineInfo::SourceLineInfo() noexcept : file(""), line( 0 ){}
     SourceLineInfo::SourceLineInfo( char const* _file, std::size_t _line ) noexcept
     :   file( _file ),
         line( _line )
diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h
index c62fafe2..269643ae 100644
--- a/include/internal/catch_common.h
+++ b/include/internal/catch_common.h
@@ -47,10 +47,10 @@ namespace Catch {
 
     struct SourceLineInfo {
 
-        SourceLineInfo() noexcept;
+        SourceLineInfo() = delete;
         SourceLineInfo( char const* _file, std::size_t _line ) noexcept;
 
-        SourceLineInfo(SourceLineInfo const& other)          = default;
+        SourceLineInfo( SourceLineInfo const& other )        = default;
         SourceLineInfo( SourceLineInfo && )                  = default;
         SourceLineInfo& operator = ( SourceLineInfo const& ) = default;
         SourceLineInfo& operator = ( SourceLineInfo && )     = default;
diff --git a/include/internal/catch_notimplemented_exception.cpp b/include/internal/catch_notimplemented_exception.cpp
index 62188ef3..f44d8e10 100644
--- a/include/internal/catch_notimplemented_exception.cpp
+++ b/include/internal/catch_notimplemented_exception.cpp
@@ -11,8 +11,7 @@
 
 namespace Catch {
 
-    NotImplementedException::NotImplementedException( SourceLineInfo const& lineInfo )
-    :   m_lineInfo( lineInfo ) {
+    NotImplementedException::NotImplementedException( SourceLineInfo const& lineInfo ) {
         std::ostringstream oss;
         oss << lineInfo << ": function ";
         oss << "not implemented";
diff --git a/include/internal/catch_notimplemented_exception.h b/include/internal/catch_notimplemented_exception.h
index 4769c57d..19e185b6 100644
--- a/include/internal/catch_notimplemented_exception.h
+++ b/include/internal/catch_notimplemented_exception.h
@@ -25,7 +25,6 @@ namespace Catch {
 
     private:
         std::string m_what;
-        SourceLineInfo m_lineInfo;
     };
 
 } // end namespace Catch
diff --git a/include/internal/catch_run_context.cpp b/include/internal/catch_run_context.cpp
index b54742ff..57e79ef6 100644
--- a/include/internal/catch_run_context.cpp
+++ b/include/internal/catch_run_context.cpp
@@ -19,10 +19,12 @@ namespace Catch {
     }
 
     RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter)
-        : m_runInfo(_config->name()),
+    :   m_runInfo(_config->name()),
         m_context(getCurrentMutableContext()),
         m_config(_config),
-        m_reporter(std::move(reporter)) {
+        m_reporter(std::move(reporter)),
+        m_lastAssertionInfo( "", SourceLineInfo("",0), "", ResultDisposition::Normal )
+    {
         m_context.setRunner(this);
         m_context.setConfig(m_config);
         m_context.setResultCapture(this);
@@ -180,7 +182,7 @@ namespace Catch {
     }
 
     const AssertionResult * RunContext::getLastResult() const {
-        return &m_lastResult;
+        return &(*m_lastResult);
     }
 
     void RunContext::exceptionEarlyReported() {
diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp
index ee923e88..9e9f8974 100644
--- a/include/internal/catch_run_context.hpp
+++ b/include/internal/catch_run_context.hpp
@@ -111,7 +111,7 @@ namespace Catch {
         IMutableContext& m_context;
         TestCase const* m_activeTestCase = nullptr;
         ITracker* m_testCaseTracker;
-        AssertionResult m_lastResult;
+        Option<AssertionResult> m_lastResult;
 
         IConfigPtr m_config;
         Totals m_totals;
diff --git a/projects/SelfTest/PartTrackerTests.cpp b/projects/SelfTest/PartTrackerTests.cpp
index ff21e74d..26473de2 100644
--- a/projects/SelfTest/PartTrackerTests.cpp
+++ b/projects/SelfTest/PartTrackerTests.cpp
@@ -37,7 +37,7 @@ using namespace Catch;
 //}
 
 Catch::TestCaseTracking::NameAndLocation makeNAL( std::string const& name ) {
-    return Catch::TestCaseTracking::NameAndLocation( name, Catch::SourceLineInfo() );
+    return Catch::TestCaseTracking::NameAndLocation( name, Catch::SourceLineInfo("",0) );
 }
 
 TEST_CASE( "Tracker" ) {