test/cli_argument_parser add an assertion to the valid input test that expects the value of unpositional arguments that are not present to be ""
parent
362ec5f4f9
commit
3b1d288d1e
|
@ -34,7 +34,6 @@ int main(int argc, char* argv[]) {
|
||||||
// test -0 -ab -12345 --long-flag -cconcatenated -d separate-value -efdouble-concatenated "positional argument 0" -gh concatenated-separate-value --long-argument-with-value-included="included value" --long-argument-with-value-separated "separate value" "positional argument 1" "positional argument 2"
|
// test -0 -ab -12345 --long-flag -cconcatenated -d separate-value -efdouble-concatenated "positional argument 0" -gh concatenated-separate-value --long-argument-with-value-included="included value" --long-argument-with-value-separated "separate value" "positional argument 1" "positional argument 2"
|
||||||
|
|
||||||
std::vector<CLI::Flag> flags;
|
std::vector<CLI::Flag> flags;
|
||||||
//flags.push_back(CLI::Flag(shortName, longName, description));
|
|
||||||
flags.push_back(CLI::Flag('0', "00000", "a short flag on its own"));
|
flags.push_back(CLI::Flag('0', "00000", "a short flag on its own"));
|
||||||
flags.push_back(CLI::Flag('a', "aaaaa", "concatenated short flags"));
|
flags.push_back(CLI::Flag('a', "aaaaa", "concatenated short flags"));
|
||||||
flags.push_back(CLI::Flag('b', "bbbbb", "concatenated short flags"));
|
flags.push_back(CLI::Flag('b', "bbbbb", "concatenated short flags"));
|
||||||
|
@ -148,6 +147,7 @@ int main(int argc, char* argv[]) {
|
||||||
ASSERT(parser.getPositionalArgument(2).value=="positional argument 2");
|
ASSERT(parser.getPositionalArgument(2).value=="positional argument 2");
|
||||||
ASSERT(!parser.getUnpositionalArgument('z').isError);
|
ASSERT(!parser.getUnpositionalArgument('z').isError);
|
||||||
ASSERT(parser.getUnpositionalArgument('z').errorCode == ErrorCodes::NOT_PRESENT);
|
ASSERT(parser.getUnpositionalArgument('z').errorCode == ErrorCodes::NOT_PRESENT);
|
||||||
|
ASSERT(parser.getUnpositionalArgument('z').value == std::string(""));
|
||||||
|
|
||||||
std::cout << "Passed valid input test." << std::endl;
|
std::cout << "Passed valid input test." << std::endl;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue