Skip to content

Commit

Permalink
Minor cleanup for Validation Error
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Feb 18, 2019
1 parent 263ab08 commit b9ef32d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions include/CLI/Option.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,8 @@ class Option : public OptionBase<Option> {

try {
err_msg = vali(result);
} catch(const ConversionError &err) {
throw ConversionError(err.what(), get_name());
} catch(const ValidationError &err) {
throw ValidationError(err.what(), get_name());
}

if(!err_msg.empty())
Expand Down
12 changes: 4 additions & 8 deletions tests/TrueFalseTest.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "app_helper.hpp"

/// This allows a set of strings to be run over by a test
struct TApp_TBO : public TApp, public ::testing::WithParamInterface<const char*> {};
struct TApp_TBO : public TApp, public ::testing::WithParamInterface<const char *> {};

TEST_P(TApp_TBO, TrueBoolOption) {
bool value = false; // Not used, but set just in case
Expand All @@ -13,12 +13,10 @@ TEST_P(TApp_TBO, TrueBoolOption) {
}

// Change to INSTANTIATE_TEST_SUITE_P in GTest master
INSTANTIATE_TEST_CASE_P(TrueBoolOptions,
TApp_TBO,
::testing::Values("true", "on", "True", "ON"),);
INSTANTIATE_TEST_CASE_P(TrueBoolOptions, TApp_TBO, ::testing::Values("true", "on", "True", "ON"), );

/// This allows a set of strings to be run over by a test
struct TApp_FBO : public TApp, public ::testing::WithParamInterface<const char*> {};
struct TApp_FBO : public TApp, public ::testing::WithParamInterface<const char *> {};

TEST_P(TApp_FBO, FalseBoolOptions) {
bool value = true; // Not used, but set just in case
Expand All @@ -29,6 +27,4 @@ TEST_P(TApp_FBO, FalseBoolOptions) {
EXPECT_FALSE(value);
}

INSTANTIATE_TEST_CASE_P(FalseBoolOptions,
TApp_FBO,
::testing::Values("false", "off", "False", "OFF"),);
INSTANTIATE_TEST_CASE_P(FalseBoolOptions, TApp_FBO, ::testing::Values("false", "off", "False", "OFF"), );

0 comments on commit b9ef32d

Please sign in to comment.