Removed default ctors for AssertionInfo, AssertionResult and SourceLineInfo

This commit is contained in:
Phil Nash 2017-08-08 01:02:24 +01:00
parent e658bacb04
commit 5e60050299
9 changed files with 11 additions and 15 deletions

View File

@ -49,8 +49,6 @@ namespace Catch {
return reconstructedExpression; return reconstructedExpression;
} }
AssertionResult::AssertionResult() {}
AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data ) AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data )
: m_info( info ), : m_info( info ),
m_resultData( data ) m_resultData( data )

View File

@ -39,7 +39,7 @@ namespace Catch {
struct AssertionInfo struct AssertionInfo
{ {
AssertionInfo() = default; AssertionInfo() = delete;
AssertionInfo( char const * _macroName, AssertionInfo( char const * _macroName,
SourceLineInfo const& _lineInfo, SourceLineInfo const& _lineInfo,
char const * _capturedExpression, char const * _capturedExpression,
@ -66,7 +66,6 @@ namespace Catch {
class AssertionResult { class AssertionResult {
public: public:
AssertionResult();
AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); AssertionResult( AssertionInfo const& info, AssertionResultData const& data );
~AssertionResult(); ~AssertionResult();

View File

@ -15,7 +15,6 @@
namespace Catch { namespace Catch {
SourceLineInfo::SourceLineInfo() noexcept : file(""), line( 0 ){}
SourceLineInfo::SourceLineInfo( char const* _file, std::size_t _line ) noexcept SourceLineInfo::SourceLineInfo( char const* _file, std::size_t _line ) noexcept
: file( _file ), : file( _file ),
line( _line ) line( _line )

View File

@ -47,10 +47,10 @@ namespace Catch {
struct SourceLineInfo { struct SourceLineInfo {
SourceLineInfo() noexcept; SourceLineInfo() = delete;
SourceLineInfo( char const* _file, std::size_t _line ) noexcept; SourceLineInfo( char const* _file, std::size_t _line ) noexcept;
SourceLineInfo(SourceLineInfo const& other) = default; SourceLineInfo( SourceLineInfo const& other ) = default;
SourceLineInfo( SourceLineInfo && ) = default; SourceLineInfo( SourceLineInfo && ) = default;
SourceLineInfo& operator = ( SourceLineInfo const& ) = default; SourceLineInfo& operator = ( SourceLineInfo const& ) = default;
SourceLineInfo& operator = ( SourceLineInfo && ) = default; SourceLineInfo& operator = ( SourceLineInfo && ) = default;

View File

@ -11,8 +11,7 @@
namespace Catch { namespace Catch {
NotImplementedException::NotImplementedException( SourceLineInfo const& lineInfo ) NotImplementedException::NotImplementedException( SourceLineInfo const& lineInfo ) {
: m_lineInfo( lineInfo ) {
std::ostringstream oss; std::ostringstream oss;
oss << lineInfo << ": function "; oss << lineInfo << ": function ";
oss << "not implemented"; oss << "not implemented";

View File

@ -25,7 +25,6 @@ namespace Catch {
private: private:
std::string m_what; std::string m_what;
SourceLineInfo m_lineInfo;
}; };
} // end namespace Catch } // end namespace Catch

View File

@ -22,7 +22,9 @@ namespace Catch {
: m_runInfo(_config->name()), : m_runInfo(_config->name()),
m_context(getCurrentMutableContext()), m_context(getCurrentMutableContext()),
m_config(_config), 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.setRunner(this);
m_context.setConfig(m_config); m_context.setConfig(m_config);
m_context.setResultCapture(this); m_context.setResultCapture(this);
@ -180,7 +182,7 @@ namespace Catch {
} }
const AssertionResult * RunContext::getLastResult() const { const AssertionResult * RunContext::getLastResult() const {
return &m_lastResult; return &(*m_lastResult);
} }
void RunContext::exceptionEarlyReported() { void RunContext::exceptionEarlyReported() {

View File

@ -111,7 +111,7 @@ namespace Catch {
IMutableContext& m_context; IMutableContext& m_context;
TestCase const* m_activeTestCase = nullptr; TestCase const* m_activeTestCase = nullptr;
ITracker* m_testCaseTracker; ITracker* m_testCaseTracker;
AssertionResult m_lastResult; Option<AssertionResult> m_lastResult;
IConfigPtr m_config; IConfigPtr m_config;
Totals m_totals; Totals m_totals;

View File

@ -37,7 +37,7 @@ using namespace Catch;
//} //}
Catch::TestCaseTracking::NameAndLocation makeNAL( std::string const& name ) { 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" ) { TEST_CASE( "Tracker" ) {