aboutsummaryrefslogtreecommitdiff
path: root/test.cxx
diff options
context:
space:
mode:
authorPavel Belikov <pavel.fuchs.belikov@gmail.com>2017-11-06 10:58:48 +0300
committerPavel Belikov <pavel.fuchs.belikov@gmail.com>2017-11-06 10:58:48 +0300
commit3419d110deb32ef2b840cfc3094b89b9e02efe88 (patch)
treee5cf15ba1e6c2aa2875846ef85313a91f865aa50 /test.cxx
parentadd description for commands (diff)
downloadargs.hxx-3419d110deb32ef2b840cfc3094b89b9e02efe88.tar.xz
add help output for commands
Diffstat (limited to 'test.cxx')
-rw-r--r--test.cxx35
1 files changed, 27 insertions, 8 deletions
diff --git a/test.cxx b/test.cxx
index e95786e..18b8c69 100644
--- a/test.cxx
+++ b/test.cxx
@@ -763,17 +763,36 @@ TEST_CASE("Subparser help works as expected", "[args]")
c.Parse();
});
+ p.Prog("git");
+
+ std::ostringstream s;
+
auto d = p.GetDescription(p.helpParams, 0);
- REQUIRE(d.size() == 3);
- REQUIRE(std::get<0>(d[0]) == "-g");
- REQUIRE(std::get<0>(d[1]) == "add");
- REQUIRE(std::get<0>(d[2]) == "commit");
+ s << p;
+ REQUIRE(s.str() == R"( git {OPTIONS}
+
+ git-like parser
+
+ OPTIONS:
+
+ -g global flag
+ add add file contents to the index
+ commit record changes to the repository
+
+)");
p.ParseArgs(std::vector<std::string>{"add"});
- d = p.GetDescription(p.helpParams, 0);
- REQUIRE(d.size() == 2);
- REQUIRE(std::get<0>(d[0]) == "add");
- REQUIRE(std::get<0>(d[1]) == "-f");
+ s.str("");
+ s << p;
+ REQUIRE(s.str() == R"( git add {OPTIONS}
+
+ add file contents to the index
+
+ OPTIONS:
+
+ -f flag
+
+)");
}
#undef ARGS_HXX