1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-29 12:13:52 +00:00
CLI11/tests/OptionalTest.cpp
Henry Fredrick Schreiner 67c4eb71e5 Style and typo fix
2018-04-04 18:29:32 +02:00

32 lines
480 B
C++

#include <cstdlib>
#include <iostream>
#include "app_helper.hpp"
#ifdef CLI11_OPTIONAL
TEST_F(TApp, OptionalTest) {
CLI::optional<int> opt;
app.add_option("-c,--count", opt);
run();
EXPECT_FALSE(opt);
app.reset();
args = {"-c", "1"};
run();
EXPECT_TRUE(opt);
EXPECT_EQ(*opt, 1);
app.reset();
args = {"--count", "3"};
run();
EXPECT_TRUE(opt);
EXPECT_EQ(*opt, 3);
}
#else
TEST_F(TApp, DISABLED_OptionalTest) {}
#endif