Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Fix overloads of Arg::parse() #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/clara.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ namespace detail {
public:
using ParserRefImpl::ParserRefImpl;

using ParserBase::parse;

auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override {
auto validationResult = validate();
if( !validationResult )
Expand Down
12 changes: 12 additions & 0 deletions src/ClaraTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ TEST_CASE( "single parsers" ) {
}
}

TEST_CASE( "single arg" ) {
std::string name;
auto p = Arg(name, "one lonely arg");

REQUIRE( name == "" );

SECTION( "foo" ) {
p.parse( Args{ "TestApp", "foo" } );
REQUIRE( name == "foo" );
}
}

struct Config {
int m_rngSeed;
std::string m_name;
Expand Down