Skip to content

Commit

Permalink
Clara cleanups
Browse files Browse the repository at this point in the history
* Clara is now split between a header and a cpp file.
* Removed the deprecated `+` and `+=` operators for composing
  a parser.
* Renamed `clara` and `detail` namespaces to be inline with the
rest of Catch2 (they are now `Clara` and `Detail` respectively).
* Taken most of user-exposed types out of the `Detail` namespace
completely (instead of using `using` directives to bring them into
the outer namespace).
  • Loading branch information
horenmar committed Aug 10, 2020
1 parent b824d06 commit 24b83ed
Show file tree
Hide file tree
Showing 9 changed files with 1,080 additions and 967 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ set(INTERNAL_HEADERS
${SOURCES_DIR}/catch_assertion_result.hpp
${SOURCES_DIR}/internal/catch_test_macro_impl.hpp
${SOURCES_DIR}/internal/catch_clara.hpp
${SOURCES_DIR}/internal/catch_clara_upstream.hpp
${SOURCES_DIR}/internal/catch_commandline.hpp
${SOURCES_DIR}/internal/catch_common.hpp
${SOURCES_DIR}/internal/catch_compiler_capabilities.hpp
Expand Down Expand Up @@ -138,6 +137,7 @@ set(IMPL_SOURCES
${SOURCES_DIR}/internal/catch_assertion_handler.cpp
${SOURCES_DIR}/catch_assertion_result.cpp
${SOURCES_DIR}/matchers/internal/catch_matchers_combined_tu.cpp
${SOURCES_DIR}/internal/catch_clara.cpp
${SOURCES_DIR}/internal/catch_commandline.cpp
${SOURCES_DIR}/internal/catch_common.cpp
${SOURCES_DIR}/catch_config.cpp
Expand Down
1 change: 0 additions & 1 deletion src/catch2/catch_all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <catch2/interfaces/catch_interfaces_all.hpp>
#include <catch2/internal/catch_assertion_handler.hpp>
#include <catch2/internal/catch_clara.hpp>
#include <catch2/internal/catch_clara_upstream.hpp>
#include <catch2/internal/catch_commandline.hpp>
#include <catch2/internal/catch_common.hpp>
#include <catch2/internal/catch_compiler_capabilities.hpp>
Expand Down
6 changes: 3 additions & 3 deletions src/catch2/catch_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ namespace Catch {
if( m_startupExceptions )
return 1;

auto result = m_cli.parse( clara::Args( argc, argv ) );
auto result = m_cli.parse( Clara::Args( argc, argv ) );
if( !result ) {
config();
getCurrentMutableContext().setConfig(m_config.get());
Expand Down Expand Up @@ -239,10 +239,10 @@ namespace Catch {
return exitCode;
}

clara::Parser const& Session::cli() const {
Clara::Parser const& Session::cli() const {
return m_cli;
}
void Session::cli( clara::Parser const& newParser ) {
void Session::cli( Clara::Parser const& newParser ) {
m_cli = newParser;
}
ConfigData& Session::configData() {
Expand Down
6 changes: 3 additions & 3 deletions src/catch2/catch_session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ namespace Catch {

int run();

clara::Parser const& cli() const;
void cli( clara::Parser const& newParser );
Clara::Parser const& cli() const;
void cli( Clara::Parser const& newParser );
ConfigData& configData();
Config& config();
private:
int runInternal();

clara::Parser m_cli;
Clara::Parser m_cli;
ConfigData m_configData;
Detail::unique_ptr<Config> m_config;
bool m_startupExceptions = false;
Expand Down
Loading

0 comments on commit 24b83ed

Please sign in to comment.