| 11 | #include "mini_test.hpp" |
| 12 | |
| 13 | int main(int, const char**) |
| 14 | { |
| 15 | using namespace lyra; |
| 16 | bfg::mini_test::scope test; |
| 17 | |
| 18 | { |
| 19 | bool show_help = false; |
| 20 | std::string message; |
| 21 | // Ex: <exe> --repeat=10 "Hello world." |
| 22 | auto cli |
| 23 | = lyra::cli() |
| 24 | | help(show_help) |
| 25 | | lyra::arg(message, "++message++").help("**message**"); |
| 26 | std::ostringstream help_text; |
| 27 | help_text << cli ; |
| 28 | test |
| 29 | (REQUIRE(help_text.str().find("**message**") != std::string::npos)) |
| 30 | (REQUIRE(help_text.str().find("[<++message++>]") != std::string::npos)); |
| 31 | } |
| 32 | |
| 33 | { |
| 34 | bool show_help = false; |
| 35 | std::string message; |
| 36 | // Ex: <exe> --repeat=10 "Hello world." |
| 37 | auto cli |
| 38 | = lyra::cli() |
| 39 | | help(show_help) |
| 40 | | lyra::arg(message, "++message++").help("**message**").required(); |
| 41 | std::ostringstream help_text; |
| 42 | help_text << cli ; |
| 43 | test |
| 44 | (REQUIRE(help_text.str().find("**message**") != std::string::npos)) |
| 45 | (REQUIRE(help_text.str().find("[<++message++>]") == std::string::npos)) |
| 46 | (REQUIRE(help_text.str().find("++message++") != std::string::npos)); |
| 47 | } |
| 48 | |
| 49 | return test; |
| 50 | } |