Commit 43ec307781a979e991b5138744d214394df6c175

Authored by Henry Fredrick Schreiner
Committed by Henry Schreiner
1 parent 48cb5008

Better message about optional test, warning suppression

.appveyor.yml
... ... @@ -18,7 +18,9 @@ build_script:
18 18 - conan create . CLIUtils/CLI11
19 19  
20 20 test_script:
  21 + - cd build
21 22 - ctest --output-on-failure -C Debug
  23 + - tests\OptionalTest
22 24  
23 25 notifications:
24 26 - provider: Webhook
... ...
.ci/make_and_test.sh
... ... @@ -15,6 +15,7 @@ echo "Testing..."
15 15 set -evx
16 16  
17 17 ctest --output-on-failure
  18 +./tests/OptionalTest
18 19  
19 20 set +evx
20 21 echo -en "travis_fold:end:script.test\\r"
... ...
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
... ...