Skip to content

Commit

Permalink
Better message about optional test, warning suppression
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Apr 4, 2018
1 parent e0bcc36 commit bc895e3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ build_script:

test_script:
- ctest --output-on-failure -C Debug
- ./tests/OptionalTest

notifications:
- provider: Webhook
Expand Down
1 change: 1 addition & 0 deletions .ci/make_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ echo "Testing..."
set -evx

ctest --output-on-failure
./tests/OptionalTest

set +evx
echo -en "travis_fold:end:script.test\\r"
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
if(MSVC)
add_definitions("/W4")
else()
add_definitions(-Wall -Wextra -pedantic)
add_definitions(-Wall -Wextra -pedantic -Wno-deprecated-declarations)
endif()

if(CMAKE_VERSION VERSION_GREATER 3.6)
Expand Down
2 changes: 1 addition & 1 deletion include/CLI/Option.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ class Option : public OptionBase<Option> {
template <typename T = App> Option *requires(std::string opt_name) {
for(const Option_p &opt : dynamic_cast<T *>(parent_)->options_)
if(opt.get() != this && opt->check_name(opt_name))
return requires(opt.get());
return needs(opt.get());
throw IncorrectConstruction::MissingOption(opt_name);
}

Expand Down
8 changes: 6 additions & 2 deletions tests/OptionalTest.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include <cstdlib>
#include <iostream>

#if CLI11_OPTIONAL

#include "app_helper.hpp"

#if CLI11_OPTIONAL

TEST_F(TApp, OptionalTest) {
optional<int> opt;
app.add_option("-c,--count", opt);
Expand All @@ -24,4 +24,8 @@ TEST_F(TApp, OptionalTest) {
EXPECT_EQ(*opt, 3);
}

#else

TEST_F(TApp, DISABLED_OptionalTest) {}

#endif

0 comments on commit bc895e3

Please sign in to comment.