argparse/test/test_help.cpp
Zhihao Yuan 1af8b826c8
Annotate test cases with doctest::test_suite
This change also explicitly lists the source files
for CMake.  This is because `GLOB` does not remove
old files when switching branches in Git, and
`CONFIGURE_DEPENDS` will add unstaged files after
stashing.

See also: https://cmake.org/cmake/help/latest/command/file.html#glob
2019-11-21 14:24:50 -06:00

20 lines
447 B
C++

#include <doctest.hpp>
#include <argparse.hpp>
using doctest::test_suite;
TEST_CASE("Users can format help message" * test_suite("help")) {
argparse::ArgumentParser program("test");
program.add_argument("input")
.help("positional input");
program.add_argument("-c")
.help("optional input");
std::ostringstream s;
s << program;
REQUIRE_FALSE(s.str().empty());
auto msg = program.help().str();
REQUIRE(msg == s.str());
}