Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorMartin Hořeňovský2017-06-05 17:19:42 +0200
committerMartin Hořeňovský2017-06-05 17:19:42 +0200
commit7f6773bb4d4bcdb7858e63f906e8a80e746bea7e (patch)
tree947fb02bfb2c860cffd6b08c29b461f17bf3c64d /include
parentb459bb4c431670cb3031a68f4b3cf79f631d0c48 (diff)
parent3e018ef131878f32950d3622300e282c1c8a6594 (diff)
downloadcatch3-7f6773bb4d4bcdb7858e63f906e8a80e746bea7e.tar.gz
Merge branch 'master' into dev-modernize
Hopefully nothing went too wrong.
Diffstat (limited to 'include')
-rw-r--r--include/catch_session.hpp26
-rw-r--r--include/internal/catch_assertionresult.h4
-rw-r--r--include/internal/catch_default_main.hpp8
-rw-r--r--include/internal/catch_fatal_condition.hpp4
-rw-r--r--include/internal/catch_objc.hpp2
-rw-r--r--include/internal/catch_run_context.hpp7
-rw-r--r--include/internal/catch_xmlwriter.hpp2
-rw-r--r--include/reporters/catch_reporter_bases.hpp2
-rw-r--r--include/reporters/catch_reporter_teamcity.hpp5
9 files changed, 47 insertions, 13 deletions
diff --git a/include/catch_session.hpp b/include/catch_session.hpp
index 4fcdfafe..486d093a 100644
--- a/include/catch_session.hpp
+++ b/include/catch_session.hpp
@@ -166,6 +166,32 @@ namespace Catch {
return returnCode;
}
+ #if defined(WIN32) && defined(UNICODE)
+ int run( int argc, wchar_t const* const* const argv ) {
+
+ char **utf8Argv = new char *[ argc ];
+
+ for ( int i = 0; i < argc; ++i ) {
+ int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL );
+
+ utf8Argv[ i ] = new char[ bufSize ];
+
+ WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL );
+ }
+
+ int returnCode = applyCommandLine( argc, utf8Argv );
+ if( returnCode == 0 )
+ returnCode = run();
+
+ for ( int i = 0; i < argc; ++i )
+ delete [] utf8Argv[ i ];
+
+ delete [] utf8Argv;
+
+ return returnCode;
+ }
+ #endif
+
int run() {
if( m_configData.showHelp )
return 0;
diff --git a/include/internal/catch_assertionresult.h b/include/internal/catch_assertionresult.h
index 24ab4f62..3f7bc7af 100644
--- a/include/internal/catch_assertionresult.h
+++ b/include/internal/catch_assertionresult.h
@@ -33,8 +33,8 @@ namespace Catch {
template<typename T> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator && ( T const& );
template<typename T> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator || ( T const& );
- private:
- DecomposedExpression& operator = (DecomposedExpression const&);
+ private:
+ DecomposedExpression& operator = (DecomposedExpression const&);
};
struct AssertionInfo
diff --git a/include/internal/catch_default_main.hpp b/include/internal/catch_default_main.hpp
index a0c4239d..e9f466c0 100644
--- a/include/internal/catch_default_main.hpp
+++ b/include/internal/catch_default_main.hpp
@@ -10,9 +10,15 @@
#ifndef __OBJC__
+#if defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
+// Standard C/C++ Win32 Unicode wmain entry point
+extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) {
+#else
// Standard C/C++ main entry point
int main (int argc, char * argv[]) {
- int result = Catch::Session().run( argc, argv );
+#endif
+
+ int result = Catch::Session().run( argc, argv );
return ( result < 0xff ? result : 0xff );
}
diff --git a/include/internal/catch_fatal_condition.hpp b/include/internal/catch_fatal_condition.hpp
index 810d9e0f..26903fe7 100644
--- a/include/internal/catch_fatal_condition.hpp
+++ b/include/internal/catch_fatal_condition.hpp
@@ -28,7 +28,7 @@ namespace Catch {
namespace Catch {
struct FatalConditionHandler {
- void reset() {}
+ void reset() {}
};
}
@@ -106,7 +106,7 @@ namespace Catch {
namespace Catch {
struct FatalConditionHandler {
- void reset() {}
+ void reset() {}
};
}
diff --git a/include/internal/catch_objc.hpp b/include/internal/catch_objc.hpp
index baded73e..30237ac4 100644
--- a/include/internal/catch_objc.hpp
+++ b/include/internal/catch_objc.hpp
@@ -104,7 +104,7 @@ namespace Catch {
namespace Matchers {
namespace Impl {
namespace NSStringMatchers {
-
+
struct StringHolder : MatcherBase<NSString*>{
StringHolder( NSString* substr ) : m_substr( [substr copy] ){}
StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){}
diff --git a/include/internal/catch_run_context.hpp b/include/internal/catch_run_context.hpp
index d262f78c..375d8cb6 100644
--- a/include/internal/catch_run_context.hpp
+++ b/include/internal/catch_run_context.hpp
@@ -142,8 +142,9 @@ namespace Catch {
m_totals.assertions.failed++;
}
- if( m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) ) )
- m_messages.clear();
+ // We have no use for the return value (whether messages should be cleared), because messages were made scoped
+ // and should be let to clear themselves out.
+ static_cast<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals)));
// Reset working state
m_lastAssertionInfo = AssertionInfo( std::string(), m_lastAssertionInfo.lineInfo, "{Unknown expression after the reported line}" , m_lastAssertionInfo.resultDisposition );
@@ -296,7 +297,7 @@ namespace Catch {
// This just means the test was aborted due to failure
}
catch(...) {
- // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions
+ // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions
// are reported without translation at the point of origin.
if (m_shouldReportUnexpected) {
makeUnexpectedResultBuilder().useActiveException();
diff --git a/include/internal/catch_xmlwriter.hpp b/include/internal/catch_xmlwriter.hpp
index 0b951c71..35ae1648 100644
--- a/include/internal/catch_xmlwriter.hpp
+++ b/include/internal/catch_xmlwriter.hpp
@@ -10,7 +10,6 @@
#include "catch_stream.h"
#include "catch_compiler_capabilities.h"
-#include "catch_suppress_warnings.h"
#include <sstream>
#include <string>
@@ -230,6 +229,5 @@ namespace Catch {
};
}
-#include "catch_reenable_warnings.h"
#endif // TWOBLUECUBES_CATCH_XMLWRITER_HPP_INCLUDED
diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp
index bc8db1c5..27767060 100644
--- a/include/reporters/catch_reporter_bases.hpp
+++ b/include/reporters/catch_reporter_bases.hpp
@@ -29,7 +29,7 @@ namespace Catch {
// + 1 for null terminator
const size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;
char buffer[maxDoubleSize];
-
+
// Save previous errno, to prevent sprintf from overwriting it
ErrnoGuard guard;
#ifdef _MSC_VER
diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp
index 79f40f92..623ae6a3 100644
--- a/include/reporters/catch_reporter_teamcity.hpp
+++ b/include/reporters/catch_reporter_teamcity.hpp
@@ -143,6 +143,7 @@ namespace Catch {
}
virtual void testCaseStarting( TestCaseInfo const& testInfo ) override {
+ m_testTimer.start();
StreamingReporterBase::testCaseStarting( testInfo );
stream << "##teamcity[testStarted name='"
<< escape( testInfo.name ) << "']\n";
@@ -159,7 +160,8 @@ namespace Catch {
<< escape( testCaseStats.testInfo.name )
<< "' out='" << escape( testCaseStats.stdErr ) << "']\n";
stream << "##teamcity[testFinished name='"
- << escape( testCaseStats.testInfo.name ) << "']\n";
+ << escape( testCaseStats.testInfo.name ) << "' duration='"
+ << m_testTimer.getElapsedMilliseconds() << "']\n";
}
private:
@@ -198,6 +200,7 @@ namespace Catch {
}
private:
bool m_headerPrintedForThisSection = false;
+ Timer m_testTimer;
};
#ifdef CATCH_IMPL