Commit 43ec307781a979e991b5138744d214394df6c175
Committed by
Henry Schreiner
1 parent
48cb5008
Better message about optional test, warning suppression
Showing
5 changed files
with
11 additions
and
4 deletions
.appveyor.yml
.ci/make_and_test.sh
CMakeLists.txt
| ... | ... | @@ -27,7 +27,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) |
| 27 | 27 | if(MSVC) |
| 28 | 28 | add_definitions("/W4") |
| 29 | 29 | else() |
| 30 | - add_definitions(-Wall -Wextra -pedantic) | |
| 30 | + add_definitions(-Wall -Wextra -pedantic -Wno-deprecated-declarations) | |
| 31 | 31 | endif() |
| 32 | 32 | |
| 33 | 33 | if(CMAKE_VERSION VERSION_GREATER 3.6) | ... | ... |
include/CLI/Option.hpp
| ... | ... | @@ -309,7 +309,7 @@ class Option : public OptionBase<Option> { |
| 309 | 309 | template <typename T = App> Option *requires(std::string opt_name) { |
| 310 | 310 | for(const Option_p &opt : dynamic_cast<T *>(parent_)->options_) |
| 311 | 311 | if(opt.get() != this && opt->check_name(opt_name)) |
| 312 | - return requires(opt.get()); | |
| 312 | + return needs(opt.get()); | |
| 313 | 313 | throw IncorrectConstruction::MissingOption(opt_name); |
| 314 | 314 | } |
| 315 | 315 | ... | ... |
tests/OptionalTest.cpp
| 1 | 1 | #include <cstdlib> |
| 2 | 2 | #include <iostream> |
| 3 | 3 | |
| 4 | -#if CLI11_OPTIONAL | |
| 5 | - | |
| 6 | 4 | #include "app_helper.hpp" |
| 7 | 5 | |
| 6 | +#if CLI11_OPTIONAL | |
| 7 | + | |
| 8 | 8 | TEST_F(TApp, OptionalTest) { |
| 9 | 9 | optional<int> opt; |
| 10 | 10 | app.add_option("-c,--count", opt); |
| ... | ... | @@ -24,4 +24,8 @@ TEST_F(TApp, OptionalTest) { |
| 24 | 24 | EXPECT_EQ(*opt, 3); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | +#else | |
| 28 | + | |
| 29 | +TEST_F(TApp, DISABLED_OptionalTest) {} | |
| 30 | + | |
| 27 | 31 | #endif | ... | ... |