From 788f81230f80cec0551e345cbe42e7d9288fe1f7 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 12 Jun 2018 13:42:33 +0100 Subject: [PATCH] Fixed errors and warnings on OC project --- include/internal/catch_assertionhandler.cpp | 2 +- include/internal/catch_objc.hpp | 2 +- include/internal/catch_string_manip.cpp | 2 +- include/internal/catch_test_case_info.cpp | 6 +++--- include/internal/catch_timer.cpp | 2 +- include/internal/catch_tostring.cpp | 8 ++------ .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ projects/XCode/OCTest/catch_objc_impl.mm | 4 +++- 8 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 projects/XCode/OCTest/OCTest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/include/internal/catch_assertionhandler.cpp b/include/internal/catch_assertionhandler.cpp index c6818c14..dd488c9c 100644 --- a/include/internal/catch_assertionhandler.cpp +++ b/include/internal/catch_assertionhandler.cpp @@ -18,7 +18,7 @@ namespace Catch { - auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& { + inline auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& { expr.streamReconstructedExpression( os ); return os; } diff --git a/include/internal/catch_objc.hpp b/include/internal/catch_objc.hpp index b43f3352..39cbb1fa 100644 --- a/include/internal/catch_objc.hpp +++ b/include/internal/catch_objc.hpp @@ -93,7 +93,7 @@ namespace Catch { std::string desc = Detail::getAnnotation( cls, "Description", testCaseName ); const char* className = class_getName( cls ); - getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, name.c_str(), desc.c_str(), SourceLineInfo("",0) ) ); + getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, NameAndTags( name.c_str(), desc.c_str() ), SourceLineInfo("",0) ) ); noTestMethods++; } } diff --git a/include/internal/catch_string_manip.cpp b/include/internal/catch_string_manip.cpp index 84762044..68f54e01 100644 --- a/include/internal/catch_string_manip.cpp +++ b/include/internal/catch_string_manip.cpp @@ -29,7 +29,7 @@ namespace Catch { bool contains( std::string const& s, std::string const& infix ) { return s.find( infix ) != std::string::npos; } - char toLowerCh(char c) { + inline char toLowerCh(char c) { return static_cast( std::tolower( c ) ); } void toLowerInPlace( std::string& s ) { diff --git a/include/internal/catch_test_case_info.cpp b/include/internal/catch_test_case_info.cpp index 46164221..3fe5389e 100644 --- a/include/internal/catch_test_case_info.cpp +++ b/include/internal/catch_test_case_info.cpp @@ -19,7 +19,7 @@ namespace Catch { - TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) { + inline TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) { if( startsWith( tag, '.' ) || tag == "!hide" ) return TestCaseInfo::IsHidden; @@ -36,10 +36,10 @@ namespace Catch { else return TestCaseInfo::None; } - bool isReservedTag( std::string const& tag ) { + inline bool isReservedTag( std::string const& tag ) { return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast(tag[0]) ); } - void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { + inline void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { CATCH_ENFORCE( !isReservedTag(tag), "Tag name: [" << tag << "] is not allowed.\n" << "Tag names starting with non alpha-numeric characters are reserved\n" diff --git a/include/internal/catch_timer.cpp b/include/internal/catch_timer.cpp index 6786efb0..12c04865 100644 --- a/include/internal/catch_timer.cpp +++ b/include/internal/catch_timer.cpp @@ -18,7 +18,7 @@ namespace Catch { return std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); } - auto estimateClockResolution() -> uint64_t { + inline auto estimateClockResolution() -> uint64_t { uint64_t sum = 0; static const uint64_t iterations = 1000000; diff --git a/include/internal/catch_tostring.cpp b/include/internal/catch_tostring.cpp index 0d0158fa..c0d90444 100644 --- a/include/internal/catch_tostring.cpp +++ b/include/internal/catch_tostring.cpp @@ -12,11 +12,6 @@ # pragma clang diagnostic ignored "-Wglobal-constructors" #endif -// Enable specific decls locally -#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) -#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -#endif - #include "catch_tostring.h" #include "catch_interfaces_config.h" #include "catch_context.h" @@ -229,13 +224,14 @@ std::string StringMaker::convert(double value) { return fpToString(value, 10); } +#if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) std::string ratio_string::symbol() { return "a"; } std::string ratio_string::symbol() { return "f"; } std::string ratio_string::symbol() { return "p"; } std::string ratio_string::symbol() { return "n"; } std::string ratio_string::symbol() { return "u"; } std::string ratio_string::symbol() { return "m"; } - +#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER } // end namespace Catch diff --git a/projects/XCode/OCTest/OCTest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/projects/XCode/OCTest/OCTest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/projects/XCode/OCTest/OCTest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/projects/XCode/OCTest/catch_objc_impl.mm b/projects/XCode/OCTest/catch_objc_impl.mm index 01443cc9..08622789 100644 --- a/projects/XCode/OCTest/catch_objc_impl.mm +++ b/projects/XCode/OCTest/catch_objc_impl.mm @@ -29,6 +29,7 @@ #include "../../../include/internal/catch_matchers.cpp" #include "../../../include/internal/catch_matchers_string.cpp" #include "../../../include/internal/catch_message.cpp" +#include "../../../include/internal/catch_output_redirect.cpp" #include "../../../include/internal/catch_random_number_generator.cpp" #include "../../../include/internal/catch_registry_hub.cpp" #include "../../../include/internal/catch_reporter_registry.cpp" @@ -53,6 +54,7 @@ #include "../../../include/internal/catch_timer.cpp" #include "../../../include/internal/catch_tostring.cpp" #include "../../../include/internal/catch_totals.cpp" +#include "../../../include/internal/catch_uncaught_exceptions.cpp" #include "../../../include/internal/catch_version.cpp" #include "../../../include/internal/catch_wildcard_pattern.cpp" #include "../../../include/internal/catch_xmlwriter.cpp" @@ -63,5 +65,5 @@ #include "../../../include/reporters/catch_reporter_compact.cpp" #include "../../../include/reporters/catch_reporter_console.cpp" #include "../../../include/reporters/catch_reporter_junit.cpp" -#include "../../../include/reporters/catch_reporter_multi.cpp" +#include "../../../include/reporters/catch_reporter_listening.cpp" #include "../../../include/reporters/catch_reporter_xml.cpp"