Commits

Matt Oswald committed 690d85f

more updates to get things running when built with g++ (now it runs, but test `TestsDoNotAbortOnCheck` always dumps core...)

Comments (0)

Files changed (10)

.build/build.sconscript

 else:
     env['CXX'] = 'g++-4.7'
     #env.Append(CCFLAGS = [ '-Wall', '-Wextra', '-pedantic', '-fpermissive', '-std=c++11' ])
-    env.Append(CCFLAGS = [ '-fpermissive', '-w', '-std=c++11' ])
+    env.Append(CCFLAGS = [ '-pthread', '-fPIC', '-fpermissive', '-w', '-std=c++11' ])

.build/debug.sconscript

 
 copy = env.Clone()
 copy.Append(CPPDEFINES = ['DEBUG', '_DEBUG'])
+copy.Append(CCFLAGS = [ '-g' ])
 
 Return("copy")

Tests/UnitTests/Assert.DoesNotThrow.cpp

 #include "xUnit++/xUnit++.h"
+#include <stdexcept>
 
 using xUnitpp::xUnitAssert;
 
 
     try
     {
-        Assert.DoesNotThrow([=]() { throw std::exception(msg.c_str()); });
+        Assert.DoesNotThrow([=]() { throw std::runtime_error(msg.c_str()); });
     }
     catch(const xUnitAssert &)
     {
 
     try
     {
-        Assert.DoesNotThrow([=]() { throw std::exception(exceptionMessage.c_str()); }) << userMessage;
+        Assert.DoesNotThrow([=]() { throw std::runtime_error(exceptionMessage.c_str()); }) << userMessage;
     }
     catch(const xUnitAssert &assert)
     {

Tests/UnitTests/Theory.cpp

         {
         }
 
-        virtual void ReportAllTestsComplete(size_t, size_t, size_t, xUnitpp::Time::Duration) override 
+        virtual void ReportAllTestsComplete(size_t, size_t, size_t, xUnitpp::Time::Duration) override
         {
         }
     } emptyReporter;
     Assert.Throws<xUnitpp::xUnitAssert>([&]() { Assert.Empty(str); });
 }
 
+#if defined(WIN32)
 DATA_THEORY(TestingLambdasAsData, (std::function<void()> fn),
-([]()
+([]() -> std::vector<std::tuple<std::function<void()>>>
 {
     std::vector<std::tuple<std::function<void()>>> data;
     data.emplace_back(std::make_tuple([]() { }));
 {
     Assert.DoesNotThrow(fn);
 }
+#endif
 
 }

Tests/UnitTests/sconscript

 local.VariantDir(intDir, './', duplicate = 0)
 local.Append(CPPPATH = ['../../xUnit++'])
 
-target = local.SharedLibrary(targetFile + '$SHLIBSUFFIX', Glob(intDir + '*.cpp'), LIBS = env['xUnit'])
+sources = Glob(intDir + '*.cpp')
+sources = sources + Glob(intDir + '/Helpers/*.cpp')
+
+target = local.SharedLibrary(targetFile + '$SHLIBSUFFIX', sources, LIBS = env['xUnit'])
 
 Return('target')

xUnit++.console/CommandLine.cpp

 #include "CommandLine.h"
+#include <algorithm>
 #include <functional>
 #include <queue>
 #include <sstream>
                 }
                 else if (opt == "-i" || opt == "--include")
                 {
-                    auto error = EatKeyValuePairs(opt, arguments, [&](std::pair<std::string, std::string> &&kv) { options.inclusiveAttributes.emplace(kv); });
+                    auto error = EatKeyValuePairs(opt, arguments, [&](std::pair<std::string, std::string> &&kv) { options.inclusiveAttributes.insert(kv); });
 
                     if (!error.empty())
                     {
                 }
                 else if (opt == "-e" || opt == "--exclude")
                 {
-                    auto error = EatKeyValuePairs(opt, arguments, [&](std::pair<std::string, std::string> &&kv) { options.exclusiveAttributes.emplace(kv); });
+                    auto error = EatKeyValuePairs(opt, arguments, [&](std::pair<std::string, std::string> &&kv) { options.exclusiveAttributes.insert(kv); });
 
                     if (!error.empty())
                     {

xUnit++.console/sconscript

 local.VariantDir(intDir, './', duplicate = 0)
 local.Append(CPPPATH = ['../xUnit++'])
 
-target = local.Program(targetFile + '.exe', Glob(intDir + '*.cpp'), LIBS = [env['xUnit'], 'dl' ])
+if env['windows'] == True:
+    targetFile = targetFile + '.exe'
+
+target = local.Program(targetFile, Glob(intDir + '*.cpp'), LIBS = [env['xUnit'], 'dl', 'pthread' ])
 
 Return('target')

xUnit++/src/xUnitAssert.cpp

     refCount++;
 }
 
-xUnitFailure::~xUnitFailure()
+xUnitFailure::~xUnitFailure() noexcept(false)
 {
     if (!--refCount)
     {

xUnit++/src/xUnitTestRunner.cpp

         mOutput.get().ReportStart(details);
     }
 
-    virtual void ReportFailure(const xUnitpp::TestDetails &details, const std::string &message, const xUnitpp::LineInfo &lineInfo) override 
+    virtual void ReportFailure(const xUnitpp::TestDetails &details, const std::string &message, const xUnitpp::LineInfo &lineInfo) override
     {
         std::lock_guard<std::mutex> guard(mLock);
         mOutput.get().ReportFailure(details, message, lineInfo);
         }
     }
 
-    virtual void ReportFailure(const xUnitpp::TestDetails &details, const std::string &message, const xUnitpp::LineInfo &lineInfo) override 
+    virtual void ReportFailure(const xUnitpp::TestDetails &details, const std::string &message, const xUnitpp::LineInfo &lineInfo) override
     {
         std::lock_guard<std::mutex> guard(mLock);
 
     return failedTests;
 }
 
-}
+}

xUnit++/xUnit++/xUnitMacroHelpers.h

 
 // attribute expansion helpers
 #define XU_A_1(a) \
-    attributes.emplace(std::make_pair a);
+    attributes.insert(std::make_pair a);
 #define XU_A_2(a, b) \
     XU_A_1(a) \
     XU_A_1(b)