Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Changed the way noexcept support is handled to (hopefully) fix #275 and #273

Commit
1a6f2a0a80797c854869b2d2e0ec277b0dd76e54
Author
Phil Nash ·
Parents
f1928b7f24a3

Files · Download .tar.gz

Changes

 include/internal/catch_compiler_capabilities.h      | 21 ++++++++++-----------
 include/internal/catch_evaluate.hpp                 |  2 ++
 include/internal/catch_tostring.h                   |  1 +
 .../SelfTest/Baselines/console.std.approved.txt     |  2 +-
 projects/SelfTest/Baselines/console.sw.approved.txt | 14 +++++++++++++-
 projects/SelfTest/Baselines/junit.sw.approved.txt   |  3 ++-
 projects/SelfTest/Baselines/xml.sw.approved.txt     | 15 +++++++++++++--
 .../CatchSelfTest.xcodeproj/project.pbxproj         |  6 ++++--
 8 files changed, 46 insertions(+), 18 deletions(-)

diff --git a/include/internal/catch_compiler_capabilities.h b/include/internal/catch_compiler_capabilities.h
index 0baa2b5d..76d0ffda 100644
--- a/include/internal/catch_compiler_capabilities.h
+++ b/include/internal/catch_compiler_capabilities.h
@@ -12,11 +12,13 @@
 
 #ifdef __clang__
 
-#if __has_feature(cxx_nullptr)
-
-#define CATCH_CONFIG_CPP11_NULLPTR
+#  if __has_feature(cxx_nullptr)
+#    define CATCH_CONFIG_CPP11_NULLPTR
+#  endif
 
-#endif
+#  if __has_feature(cxx_noexcept)
+#    define CATCH_CONFIG_CPP11_NOEXCEPT
+#  endif
 
 #endif // __clang__
 
@@ -108,13 +110,10 @@
 #endif
 
 // noexcept support:
-#ifdef CATCH_CPP11_OR_GREATER
-#  if (__has_feature(cxx_noexcept))
-#    define CATCH_NOEXCEPT noexcept
-#    define CATCH_NOEXCEPT_IS(x) noexcept(x)
-#  endif
-#endif
-#ifndef CATCH_NO_EXCEPT
+#if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT)
+#  define CATCH_NOEXCEPT noexcept
+#  define CATCH_NOEXCEPT_IS(x) noexcept(x)
+#else
 #  define CATCH_NOEXCEPT throw()
 #  define CATCH_NOEXCEPT_IS(x)
 #endif
diff --git a/include/internal/catch_evaluate.hpp b/include/internal/catch_evaluate.hpp
index f345d744..2f85a2b9 100644
--- a/include/internal/catch_evaluate.hpp
+++ b/include/internal/catch_evaluate.hpp
@@ -13,6 +13,8 @@
 #pragma warning(disable:4389) // '==' : signed/unsigned mismatch
 #endif
 
+#include <cstddef>
+
 namespace Catch {
 namespace Internal {
 
diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h
index 328dda7c..d6c2fcf2 100644
--- a/include/internal/catch_tostring.h
+++ b/include/internal/catch_tostring.h
@@ -15,6 +15,7 @@
 #include <iomanip>
 #include <limits>
 #include <vector>
+#include <cstddef>
 
 #ifdef __OBJC__
 #include "catch_objc_arc.hpp"
diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt
index 5158f220..693584a1 100644
--- a/projects/SelfTest/Baselines/console.std.approved.txt
+++ b/projects/SelfTest/Baselines/console.std.approved.txt
@@ -772,5 +772,5 @@ with expansion:
   "first" == "second"
 
 ===============================================================================
-126 test cases - 39 failed (628 assertions - 92 failed)
+127 test cases - 39 failed (629 assertions - 92 failed)
 
diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt
index 978ee1e5..6e80ffbf 100644
--- a/projects/SelfTest/Baselines/console.sw.approved.txt
+++ b/projects/SelfTest/Baselines/console.sw.approved.txt
@@ -6285,6 +6285,18 @@ PASSED:
 with expansion:
   __null == 0
 
+-------------------------------------------------------------------------------
+null_ptr
+-------------------------------------------------------------------------------
+TrickyTests.cpp:<line number>
+...............................................................................
+
+TrickyTests.cpp:<line number>:
+PASSED:
+  REQUIRE( ptr.get() == nullptr )
+with expansion:
+  __null == nullptr
+
 -------------------------------------------------------------------------------
 X/level/0/a
 -------------------------------------------------------------------------------
@@ -6668,5 +6680,5 @@ with expansion:
   true
 
 ===============================================================================
-126 test cases - 54 failed (647 assertions - 111 failed)
+127 test cases - 54 failed (648 assertions - 111 failed)
 
diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt
index 481718f0..5e7969b8 100644
--- a/projects/SelfTest/Baselines/junit.sw.approved.txt
+++ b/projects/SelfTest/Baselines/junit.sw.approved.txt
@@ -1,5 +1,5 @@
 <testsuites>
-  <testsuite name="~_" errors="12" failures="99" tests="647" hostname="tbd" time="{duration}" timestamp="tbd">
+  <testsuite name="~_" errors="12" failures="99" tests="648" hostname="tbd" time="{duration}" timestamp="tbd">
     <testcase classname="global" name="Some simple comparisons between doubles" time="{duration}"/>
     <testcase classname="global" name="Approximate comparisons with different epsilons" time="{duration}"/>
     <testcase classname="global" name="Approximate comparisons with floats" time="{duration}"/>
@@ -531,6 +531,7 @@ TrickyTests.cpp:<line number>
     <testcase classname="global" name="Comparing function pointers" time="{duration}"/>
     <testcase classname="global" name="Comparing member function pointers" time="{duration}"/>
     <testcase classname="global" name="pointer to class" time="{duration}"/>
+    <testcase classname="global" name="null_ptr" time="{duration}"/>
     <testcase classname="global" name="X/level/0/a" time="{duration}"/>
     <testcase classname="global" name="X/level/0/b" time="{duration}"/>
     <testcase classname="global" name="X/level/1/a" time="{duration}"/>
diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt
index 8905e3df..b80c7094 100644
--- a/projects/SelfTest/Baselines/xml.sw.approved.txt
+++ b/projects/SelfTest/Baselines/xml.sw.approved.txt
@@ -6548,6 +6548,17 @@ there&quot;
       </Expression>
       <OverallResult success="true"/>
     </TestCase>
+    <TestCase name="null_ptr">
+      <Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
+        <Original>
+          ptr.get() == nullptr
+        </Original>
+        <Expanded>
+          __null == nullptr
+        </Expanded>
+      </Expression>
+      <OverallResult success="true"/>
+    </TestCase>
     <TestCase name="X/level/0/a">
       <OverallResult success="true"/>
     </TestCase>
@@ -6881,7 +6892,7 @@ there&quot;
       </Section>
       <OverallResult success="true"/>
     </TestCase>
-    <OverallResults successes="536" failures="111"/>
+    <OverallResults successes="537" failures="111"/>
   </Group>
-  <OverallResults successes="536" failures="111"/>
+  <OverallResults successes="537" failures="111"/>
 </Catch>
diff --git a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
index 3f3926b5..1685cc66 100644
--- a/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
+++ b/projects/XCode/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
@@ -634,7 +634,8 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
+				CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+				CLANG_CXX_LIBRARY = "libc++";
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				PRODUCT_NAME = "$(TARGET_NAME)";
@@ -649,7 +650,8 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++98";
+				CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+				CLANG_CXX_LIBRARY = "libc++";
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
 				PRODUCT_NAME = "$(TARGET_NAME)";