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

Updated NonCopyable (to include C++11 version) and use for Session and Section

Commit
12fe67cc82e1a17512a877e5af7c819e3e27f052
Author
Phil Nash ·
Parents
e606cebac50e

Files · Download .tar.gz

Changes

 include/catch_runner.hpp         |  2 +-
 include/internal/catch_common.h  | 12 ++++++++++--
 include/internal/catch_section.h | 11 +----------
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/include/catch_runner.hpp b/include/catch_runner.hpp
index ea6299d0..67f94e3e 100644
--- a/include/catch_runner.hpp
+++ b/include/catch_runner.hpp
@@ -97,7 +97,7 @@ namespace Catch {
         std::set<TestCase> m_testsAlreadyRun;
     };
 
-    class Session {
+    class Session : NonCopyable {
         static bool alreadyInstantiated;
 
     public:
diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h
index 967b7fc2..2001c297 100644
--- a/include/internal/catch_common.h
+++ b/include/internal/catch_common.h
@@ -24,8 +24,16 @@
 namespace Catch {
 
     class NonCopyable {
-        NonCopyable( NonCopyable const& );
-        void operator = ( NonCopyable const& );
+#ifdef CATCH_CPP11_OR_GREATER
+        NonCopyable( NonCopyable const& )              = delete;
+        NonCopyable( NonCopyable && )                  = delete;
+        NonCopyable& operator = ( NonCopyable const& ) = delete;
+        NonCopyable& operator = ( NonCopyable && )     = delete;
+#else
+        NonCopyable( NonCopyable const& info );
+        NonCopyable& operator = ( NonCopyable const& );
+#endif
+
     protected:
         NonCopyable() {}
         virtual ~NonCopyable();
diff --git a/include/internal/catch_section.h b/include/internal/catch_section.h
index f83d828b..d8b3ae42 100644
--- a/include/internal/catch_section.h
+++ b/include/internal/catch_section.h
@@ -16,7 +16,7 @@
 
 namespace Catch {
 
-    class Section {
+    class Section : NonCopyable {
     public:
         Section( SectionInfo const& info );
         ~Section();
@@ -25,15 +25,6 @@ namespace Catch {
         operator bool() const;
 
     private:
-#ifdef CATCH_CPP11_OR_GREATER
-        Section( Section const& )              = delete;
-        Section( Section && )                  = delete;
-        Section& operator = ( Section const& ) = delete;
-        Section& operator = ( Section && )     = delete;
-#else
-        Section( Section const& info );
-        Section& operator = ( Section const& );
-#endif
         SectionInfo m_info;
 
         std::string m_name;