From c50dd580bdd190ca4586b5ad2e2790b366b6d5aa Mon Sep 17 00:00:00 2001 From: Henry Fredrick Schreiner Date: Fri, 17 Mar 2017 13:30:14 -0400 Subject: [PATCH] HorribleError for subcommand test --- include/CLI/App.hpp | 7 +++++++ tests/AppTest.cpp | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index d5065772..87c8b69e 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -1081,6 +1081,13 @@ struct AppFriend { return app->_parse_long(std::forward(args)...); } + /// Wrap _parse_subcommand, perfectly forward arguments and return + template + static auto parse_subcommand(App* app, Args && ...args) + -> typename std::result_of::type { + return app->_parse_subcommand(std::forward(args)...); + } + }; } diff --git a/tests/AppTest.cpp b/tests/AppTest.cpp index bc50beb9..ec01a987 100644 --- a/tests/AppTest.cpp +++ b/tests/AppTest.cpp @@ -803,3 +803,10 @@ TEST_F(TApp, CheckLongFail) { EXPECT_THROW(CLI::detail::AppFriend::parse_long(&app, args), CLI::HorribleError); } + +// Test horrible error +TEST_F(TApp, CheckSubcomFail) { + args = {"subcom"}; + + EXPECT_THROW(CLI::detail::AppFriend::parse_long(&app, args), CLI::HorribleError); +}