mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-08 07:43:52 +00:00
run some tests and fixes for C++20 (#663)
This commit is contained in:
parent
16919dd1b2
commit
728ac3a877
@ -102,6 +102,9 @@ jobs:
|
||||
gcc9:
|
||||
containerImage: gcc:9
|
||||
cli11.std: 17
|
||||
gcc11:
|
||||
containerImage: gcc:11
|
||||
cli11.std: 20
|
||||
gcc8:
|
||||
containerImage: gcc:8
|
||||
cli11.std: 17
|
||||
|
@ -799,9 +799,10 @@ class App {
|
||||
|
||||
/// Add option for flag with integer result - defaults to allowing multiple passings, but can be forced to one
|
||||
/// if `multi_option_policy(CLI::MultiOptionPolicy::Throw)` is used.
|
||||
template <typename T,
|
||||
enable_if_t<std::is_constructible<T, std::int64_t>::value && !is_bool<T>::value, detail::enabler> =
|
||||
detail::dummy>
|
||||
template <
|
||||
typename T,
|
||||
enable_if_t<std::is_constructible<T, std::int64_t>::value && !std::is_const<T>::value && !is_bool<T>::value,
|
||||
detail::enabler> = detail::dummy>
|
||||
Option *add_flag(std::string flag_name,
|
||||
T &flag_count, ///< A variable holding the count
|
||||
std::string flag_description = "") {
|
||||
|
@ -2308,3 +2308,11 @@ TEST_CASE_METHOD(TApp, "logFormSingleDash", "[app]") {
|
||||
CHECK(veryverbose);
|
||||
CHECK(veryveryverbose);
|
||||
}
|
||||
|
||||
TEST_CASE("C20_compile", "simple") {
|
||||
CLI::App app{"test"};
|
||||
auto flag = app.add_flag("--flag", "desc");
|
||||
|
||||
app.parse("--flag");
|
||||
CHECK_FALSE(flag->empty());
|
||||
}
|
||||
|
@ -239,16 +239,19 @@ TEST_CASE_METHOD(TApp, "BoostOptionalEnumTest", "[optional]") {
|
||||
auto dstring = optptr->get_default_str();
|
||||
CHECK(dstring.empty());
|
||||
run();
|
||||
CHECK(!opt);
|
||||
auto checkOpt = static_cast<bool>(opt);
|
||||
CHECK_FALSE(checkOpt);
|
||||
|
||||
args = {"-v", "3"};
|
||||
run();
|
||||
CHECK(opt);
|
||||
checkOpt = static_cast<bool>(opt);
|
||||
CHECK(checkOpt);
|
||||
CHECK(*opt == eval::val3);
|
||||
opt = {};
|
||||
args = {"--val", "1"};
|
||||
run();
|
||||
CHECK(opt);
|
||||
checkOpt = static_cast<bool>(opt);
|
||||
CHECK(checkOpt);
|
||||
CHECK(*opt == eval::val1);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user