Skip to content

Commit

Permalink
Whitespace fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Sep 6, 2017
1 parent c6ddbeb commit aae40fb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Version 1.2 (in progress)


* The name string can now contain spaces around commas [#29](https://github.com/CLIUtils/CLI11/pull/29)
* `set_default_str` now only sets string, and `set_default_val` will evaluate the default string given [#26](https://github.com/CLIUtils/CLI11/issues/26)
* Required positionals now take priority over subcommands [#23](https://github.com/CLIUtils/CLI11/issues/23)
* Extra requirements enforced by Travis
Expand Down
7 changes: 7 additions & 0 deletions include/CLI/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
#include "CLI/StringTools.hpp"
#include "CLI/TypeTools.hpp"

#define CLI11_PARSE(app,argc,argv) \
try { \
(app).parse((argc),(argv)); \
} catch(const CLI::ParseError &e) { \
return (app).exit(e); \
}

namespace CLI {

namespace detail {
Expand Down
1 change: 0 additions & 1 deletion tests/AppTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ TEST_F(TApp, Positionals) {
EXPECT_EQ("thing2", posit2);
}


TEST_F(TApp, ForcedPositional) {
std::vector<std::string> posit;
auto one = app.add_flag("--one");
Expand Down
7 changes: 2 additions & 5 deletions tests/CreationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,23 +231,20 @@ TEST_F(TApp, CheckNameNoCase) {
EXPECT_TRUE(pos2->check_name("pos2"));
}


TEST_F(TApp, PreSpaces) {
int x;
auto myapp = app.add_option(" -a, --long, other", x);

EXPECT_TRUE(myapp->check_lname("long"));
EXPECT_TRUE(myapp->check_sname("a"));
EXPECT_TRUE(myapp->check_name("other"));

}

TEST_F(TApp, AllSpaces) {
int x;
auto myapp = app.add_option(" -a , --long , other ", x);

EXPECT_TRUE(myapp->check_lname("long"));
EXPECT_TRUE(myapp->check_sname("a"));
EXPECT_TRUE(myapp->check_name("other"));

}

0 comments on commit aae40fb

Please sign in to comment.