diff --git a/.gitignore b/.gitignore index 6de4c186..541f1be6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ Debug Release *.user *.xcuserstate -/Test/Test.xcodeproj/xcuserdata/ \ No newline at end of file +/Test/Test.xcodeproj/xcuserdata/ +.DS_Store \ No newline at end of file diff --git a/include/catch.hpp b/include/catch.hpp index 0b0bb62c..d314d3c2 100644 --- a/include/catch.hpp +++ b/include/catch.hpp @@ -28,6 +28,7 @@ #include "internal/catch_generators.hpp" #include "internal/catch_interfaces_exception.h" #include "internal/catch_approx.hpp" +#include "internal/catch_test_case_info.hpp" #ifdef __OBJC__ #include "internal/catch_objc.hpp" diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index d857fc66..738b8214 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -527,7 +527,8 @@ public: const char* expr = "", bool isNot = false ) - : m_result( expr, isNot, filename, line, macroName ) + : m_result( expr, isNot, filename, line, macroName ), + m_messageStream() {} /////////////////////////////////////////////////////////////////////////// @@ -627,7 +628,7 @@ class ScopedInfo public: /////////////////////////////////////////////////////////////////////////// ScopedInfo - () + () : m_oss() { Hub::getResultCapture().pushScopedInfo( this ); } diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp index 6a4d0368..7fa7e573 100644 --- a/include/internal/catch_commandline.hpp +++ b/include/internal/catch_commandline.hpp @@ -194,6 +194,7 @@ namespace Catch return setErrorMode( m_command + " does not accept arguments" ); m_config.setShowHelp( true ); break; + case modeError: default: break; } diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h index d0181d19..ea2c53f0 100644 --- a/include/internal/catch_common.h +++ b/include/internal/catch_common.h @@ -38,6 +38,7 @@ namespace Catch void operator = ( const NonCopyable& ); protected: NonCopyable(){} + virtual ~NonCopyable() {} }; typedef char NoType; diff --git a/include/internal/catch_resultinfo.hpp b/include/internal/catch_resultinfo.hpp index 016ec8c2..258cc47c 100644 --- a/include/internal/catch_resultinfo.hpp +++ b/include/internal/catch_resultinfo.hpp @@ -24,7 +24,14 @@ namespace Catch /////////////////////////////////////////////////////////////////////////// ResultInfo () - : m_line( 0 ), + : m_macroName(), + m_filename(), + m_line( 0 ), + m_expr(), + m_lhs(), + m_rhs(), + m_op(), + m_message(), m_result( ResultWas::Unknown ), m_isNot( false ) {} @@ -44,6 +51,8 @@ namespace Catch m_filename( filename ), m_line( line ), m_expr( expr ), + m_lhs(), + m_rhs(), m_op( isNotExpression( expr ) ? "!" : "" ), m_message( message ), m_result( result ), @@ -53,6 +62,11 @@ namespace Catch m_expr = "!" + m_expr; } + /////////////////////////////////////////////////////////////////////////// + virtual ~ResultInfo + () + { + } /////////////////////////////////////////////////////////////////////////// bool ok () diff --git a/include/internal/catch_section.hpp b/include/internal/catch_section.hpp index 084aa21d..c953aba8 100644 --- a/include/internal/catch_section.hpp +++ b/include/internal/catch_section.hpp @@ -31,6 +31,8 @@ namespace Catch std::size_t line ) : m_name( name ), + m_successes(0), + m_failures(0), m_sectionIncluded( Hub::getResultCapture().sectionStarted( name, description, filename, line, m_successes, m_failures ) ) { } diff --git a/include/internal/catch_test_case_info.hpp b/include/internal/catch_test_case_info.hpp index 4e88bc4f..e27a084d 100644 --- a/include/internal/catch_test_case_info.hpp +++ b/include/internal/catch_test_case_info.hpp @@ -42,7 +42,11 @@ namespace Catch /////////////////////////////////////////////////////////////////////// TestCaseInfo () - : m_test( NULL ) + : m_test( NULL ), + m_name(), + m_description(), + m_filename(), + m_line( 0 ) { } diff --git a/include/reporters/catch_reporter_basic.hpp b/include/reporters/catch_reporter_basic.hpp index 78de2e56..35e86df5 100644 --- a/include/reporters/catch_reporter_basic.hpp +++ b/include/reporters/catch_reporter_basic.hpp @@ -211,6 +211,11 @@ namespace Catch case ResultWas::ExplicitFailure: m_config.stream() << "failed with message: '" << resultInfo.getMessage() << "'"; break; + case ResultWas::Unknown: // These cases are here to prevent compiler warnings + case ResultWas::Ok: + case ResultWas::FailureBit: + case ResultWas::ExpressionFailed: + case ResultWas::Exception: default: if( !resultInfo.hasExpression() ) { diff --git a/include/reporters/catch_reporter_junit.hpp b/include/reporters/catch_reporter_junit.hpp index 6dbc4bf3..b281fed0 100644 --- a/include/reporters/catch_reporter_junit.hpp +++ b/include/reporters/catch_reporter_junit.hpp @@ -156,6 +156,10 @@ namespace Catch case ResultWas::Ok: stats.m_element = "success"; break; + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + case ResultWas::DidntThrowException: default: stats.m_element = "unknown"; break; diff --git a/include/reporters/catch_reporter_xml.hpp b/include/reporters/catch_reporter_xml.hpp index 141ed419..792ab929 100644 --- a/include/reporters/catch_reporter_xml.hpp +++ b/include/reporters/catch_reporter_xml.hpp @@ -153,6 +153,12 @@ namespace Catch .writeText( resultInfo.getMessage() ); m_currentTestSuccess = false; break; + case ResultWas::Unknown: + case ResultWas::Ok: + case ResultWas::FailureBit: + case ResultWas::ExpressionFailed: + case ResultWas::Exception: + case ResultWas::DidntThrowException: default: break; } diff --git a/projects/XCode/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode/CatchSelfTest.xcodeproj/project.pbxproj index 5a9d6352..9dfbb9f5 100644 --- a/projects/XCode/CatchSelfTest.xcodeproj/project.pbxproj +++ b/projects/XCode/CatchSelfTest.xcodeproj/project.pbxproj @@ -385,28 +385,12 @@ SDKROOT = macosx10.6; USER_HEADER_SEARCH_PATHS = ../../include; WARNING_CFLAGS = ( - "-Wfloat-equal", - "-Wundef", - "-Wshadow", - "-Wpointer-arith", - "-Wcast-qual", - "-Wcast-align", - "-Wwrite-strings", - "-Wconversion", - "-Wsign-compare", - "-Wmissing-noreturn", - "-Wmissing-format-attribute", - "-Wpacked", - "-Winline", - "-Wdisabled-optimization", - "-Wctor-dtor-privacy", - "-Wnon-virtual-dtor", - "-Wreorder", - "-Wold-style-cast", - "-Woverloaded-virtual", - "-ffor-scope", - "-Wextra", - "-Wall", + "-Winit-self", + "-Wmissing-include-dirs", + "-Wswitch-enum", + "-Wunused", + "-Wredundant-decls", + "-Wsign-promo", ); }; name = Debug; @@ -417,10 +401,19 @@ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; SDKROOT = macosx10.6; USER_HEADER_SEARCH_PATHS = ../../include; + WARNING_CFLAGS = ( + "-Winit-self", + "-Wmissing-include-dirs", + "-Wswitch-enum", + "-Wunused", + "-Wredundant-decls", + "-Wsign-promo", + ); }; name = Release; }; diff --git a/projects/XCode/OCTest/OCTest.xcodeproj/project.pbxproj b/projects/XCode/OCTest/OCTest.xcodeproj/project.pbxproj index cdee764b..afed59e0 100644 --- a/projects/XCode/OCTest/OCTest.xcodeproj/project.pbxproj +++ b/projects/XCode/OCTest/OCTest.xcodeproj/project.pbxproj @@ -144,7 +144,14 @@ isa = PBXProject; buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "OCTest" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); mainGroup = 08FB7794FE84155DC02AAC07 /* OCTest */; projectDirPath = ""; projectRoot = ""; diff --git a/single_include/catch.hpp b/single_include/catch.hpp index cb1043b1..89800f17 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -1530,7 +1530,7 @@ public: Expression ( MutableResultInfo& result, - const T& lhs + T lhs ) : m_result( result ), m_lhs( lhs ) @@ -1638,7 +1638,7 @@ public: private: MutableResultInfo& m_result; - const T& m_lhs; + T m_lhs; }; template @@ -1727,12 +1727,12 @@ public: /////////////////////////////////////////////////////////////////////////// template - Expression operator->* + Expression operator->* ( const T & operand ) { - Expression expr( m_result, operand ); + Expression expr( m_result, operand ); return expr; } @@ -2553,30 +2553,6 @@ namespace Catch } // end namespace Catch - -#ifdef __OBJC__ -// #included from: internal/catch_objc.hpp - -/* - * catch_objc.hpp - * Catch - * - * Created by Phil on 14/11/2010. - * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. - * - * Distributed under the Boost Software License, Version 1.0. (See accompanying - * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - * - */ - -#define TWOBLUECUBES_CATCH_OBJC_HPP_INCLUDED - -#import -#include - -// NB. Any general catch headers included here must be included -// in catch.hpp first to make sure they are included by the single -// header for non obj-usage // #included from: internal/catch_test_case_info.hpp /* @@ -2804,6 +2780,30 @@ namespace Catch } +#ifdef __OBJC__ +// #included from: internal/catch_objc.hpp + +/* + * catch_objc.hpp + * Catch + * + * Created by Phil on 14/11/2010. + * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + * + */ + +#define TWOBLUECUBES_CATCH_OBJC_HPP_INCLUDED + +#import +#include + +// NB. Any general catch headers included here must be included +// in catch.hpp first to make sure they are included by the single +// header for non obj-usage + /////////////////////////////////////////////////////////////////////////////// // This protocol is really only here for (self) documenting purposes, since // all its methods are optional.