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

Made Clara a “Cliche” header, which will be usable independently of Catch.

- This is just a first step. It still has a dependency on catch_text.h, which also needs to be made a Cliche header.
- These then need their own homes on GitHub.
Commit
4554155e3dea5e21cb1bc5b9d89f571060e5d33e
Author
Phil Nash ·
Parents
7eb5acc18357

Files · Download .tar.gz

Changes

 include/internal/catch_clara.h                        | 16 ++++++++++++++++
 include/internal/catch_commandline.hpp                |  2 +-
 include/internal/clara.h                              | 19 +++++++++++++++++--
 projects/SelfTest/TestMain.cpp                        |  2 +-
 .../CatchSelfTest.xcodeproj/project.pbxproj           |  2 ++
 5 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/include/internal/catch_clara.h b/include/internal/catch_clara.h
new file mode 100644
index 00000000..636be471
--- /dev/null
+++ b/include/internal/catch_clara.h
@@ -0,0 +1,16 @@
+/*
+ *  Created by Phil on 10/2/2014.
+ *  Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ *  Distributed under the Boost Software License, Version 1.0. (See accompanying
+ *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+#ifndef TWOBLUECUBES_CATCH_CLARA_H_INCLUDED
+#define TWOBLUECUBES_CATCH_CLARA_H_INCLUDED
+
+#define CLICHE_CLARA_EMBEDDED_NAMESPACE Catch
+#include "clara.h"
+#undef CLICHE_CLARA_EMBEDDED_NAMESPACE
+
+#endif // TWOBLUECUBES_CATCH_CLARA_H_INCLUDED
diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp
index 5b80761f..ee19de85 100644
--- a/include/internal/catch_commandline.hpp
+++ b/include/internal/catch_commandline.hpp
@@ -10,7 +10,7 @@
 
 #include "catch_config.hpp"
 #include "catch_common.h"
-#include "clara.h"
+#include "catch_clara.h"
 
 #include <fstream>
 
diff --git a/include/internal/clara.h b/include/internal/clara.h
index b44d129a..494b959a 100644
--- a/include/internal/clara.h
+++ b/include/internal/clara.h
@@ -5,11 +5,22 @@
  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  */
-#ifndef TWOBLUECUBES_CLARA_H_INCLUDED
+#ifndef CLICHE_CLARA_EMBEDDED_NAMESPACE
+#ifdef TWOBLUECUBES_CLARA_H_INCLUDED
+#define TWOBLUECUBES_CLARA_H_ALREADY_INCLUDED
+#else
 #define TWOBLUECUBES_CLARA_H_INCLUDED
+#endif
+#endif
+
+#ifndef TWOBLUECUBES_CLARA_H_ALREADY_INCLUDED
 
 #include "catch_text.h" // This will get moved out too
 
+#ifdef CLICHE_CLARA_EMBEDDED_NAMESPACE
+namespace CLICHE_CLARA_EMBEDDED_NAMESPACE {
+#endif
+
 namespace Clara {
     namespace Detail {
         template<typename T> struct RemoveConstRef{ typedef T type; };
@@ -582,5 +593,9 @@ namespace Clara {
 
 } // end namespace Clara
 
+#ifdef CLICHE_CLARA_EMBEDDED_NAMESPACE
+} // end embedded namespace
+#endif
+
+#endif // TWOBLUECUBES_CLARA_H_ALREAD_INCLUDED
 
-#endif // TWOBLUECUBES_CLARA_H_INCLUDED
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp
index 575a456a..b1468cbc 100644
--- a/projects/SelfTest/TestMain.cpp
+++ b/projects/SelfTest/TestMain.cpp
@@ -16,7 +16,7 @@
 
 template<size_t size>
 void parseIntoConfig( const char * (&argv)[size], Catch::ConfigData& config ) {
-    Clara::CommandLine<Catch::ConfigData> parser = Catch::makeCommandLineParser();
+    Catch::Clara::CommandLine<Catch::ConfigData> parser = Catch::makeCommandLineParser();
     parser.parseInto( size, argv, config );
 }
 
diff --git a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
index e61b82de..20d58a9f 100644
--- a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
+++ b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
@@ -77,6 +77,7 @@
 		26847E5B16BBAB790043B9C1 /* catch_message.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_message.h; sourceTree = "<group>"; };
 		26847E5C16BBACB60043B9C1 /* catch_message.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_message.hpp; sourceTree = "<group>"; };
 		26847E5D16BBADB40043B9C1 /* catch_message.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_message.cpp; path = ../../../SelfTest/SurrogateCpps/catch_message.cpp; sourceTree = "<group>"; };
+		268F47B018A93F7800D8C14F /* catch_clara.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_clara.h; sourceTree = "<group>"; };
 		26948284179A9AB900ED166E /* SectionTrackerTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SectionTrackerTests.cpp; path = ../../../SelfTest/SectionTrackerTests.cpp; sourceTree = "<group>"; };
 		26948287179EF7F900ED166E /* catch_test_case_tracker.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_test_case_tracker.hpp; sourceTree = "<group>"; };
 		2694A1FB16A0000E004816E3 /* catch_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = catch_text.cpp; sourceTree = "<group>"; };
@@ -438,6 +439,7 @@
 				26AEAF1617BEA18E009E32C9 /* catch_platform.h */,
 				262E739A1846759000CAC268 /* catch_common.hpp */,
 				261488FC184D1DC10041FBEB /* catch_stream.h */,
+				268F47B018A93F7800D8C14F /* catch_clara.h */,
 			);
 			name = Infrastructure;
 			sourceTree = "<group>";