Skip to content

Commit 5ca5699

Browse files
committed
Format code with clang-format
1 parent 71c22b8 commit 5ca5699

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

include/libenvpp/env.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ class prefix {
472472
const auto parser_and_validator = [options = std::move(options),
473473
strings = std::move(option_strings)](const std::string_view str) {
474474
const auto value = [&]() {
475-
if constexpr(SimpleParsing) {
476-
if(strings.size() != options.size()) {
475+
if constexpr (SimpleParsing) {
476+
if (strings.size() != options.size()) {
477477
throw option_error{fmt::format("Option strings must be provided for simple option parsing")};
478478
}
479479
const auto it = std::find(strings.begin(), strings.end(), str);

test/libenvpp_test.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ enum class testing_simple_option {
7272

7373
class option_var_fixture {
7474
public:
75-
option_var_fixture() : m_var("LIBENVPP_TESTING_OPTION", "SECOND_OPTION"), m_simple("LIBENVPP_TESTING_SIMPLE_OPTION", "OPT_A") {}
75+
option_var_fixture()
76+
: m_var("LIBENVPP_TESTING_OPTION", "SECOND_OPTION"), m_simple("LIBENVPP_TESTING_SIMPLE_OPTION", "OPT_A")
77+
{
78+
}
7679

7780
private:
7881
detail::set_scoped_environment_variable m_var;
@@ -116,7 +119,8 @@ TEST_CASE_METHOD(option_var_fixture, "Retrieving option environment variable", "
116119
{
117120
auto pre = env::prefix("LIBENVPP_TESTING");
118121
const auto option_id = pre.register_variable<testing_option>("OPTION");
119-
const auto simple_option_id = pre.register_option<testing_simple_option>("SIMPLE_OPTION", {{"OPT_A", testing_simple_option::OPT_A}, {"OPT_B", testing_simple_option::OPT_B}});
122+
const auto simple_option_id = pre.register_option<testing_simple_option>(
123+
"SIMPLE_OPTION", {{"OPT_A", testing_simple_option::OPT_A}, {"OPT_B", testing_simple_option::OPT_B}});
120124
auto parsed_and_validated_pre = pre.parse_and_validate();
121125
REQUIRE(parsed_and_validated_pre.ok());
122126
const auto option_val = parsed_and_validated_pre.get(option_id);
@@ -132,11 +136,14 @@ TEST_CASE("Parsing failure with 'simple' option handling", "[libenvpp]")
132136
const auto _ = detail::set_scoped_environment_variable{"LIBENVPP_TESTING_SIMPLE_OPTION", "INVALID_OPTION"};
133137

134138
auto pre = env::prefix("LIBENVPP_TESTING");
135-
(void)pre.register_option<testing_simple_option>("SIMPLE_OPTION", {{"OPT_A", testing_simple_option::OPT_A}, {"OPT_B", testing_simple_option::OPT_B}});
139+
(void)pre.register_option<testing_simple_option>(
140+
"SIMPLE_OPTION", {{"OPT_A", testing_simple_option::OPT_A}, {"OPT_B", testing_simple_option::OPT_B}});
136141
auto parsed_and_validated_pre = pre.parse_and_validate();
137142
REQUIRE_FALSE(parsed_and_validated_pre.ok());
138-
CHECK_THAT(parsed_and_validated_pre.error_message(),
139-
ContainsSubstring("'LIBENVPP_TESTING_SIMPLE_OPTION': Unrecognized option 'INVALID_OPTION', should be one of [OPT_A, OPT_B]"));
143+
CHECK_THAT(
144+
parsed_and_validated_pre.error_message(),
145+
ContainsSubstring(
146+
"'LIBENVPP_TESTING_SIMPLE_OPTION': Unrecognized option 'INVALID_OPTION', should be one of [OPT_A, OPT_B]"));
140147
}
141148

142149
struct user_parsable_type {

0 commit comments

Comments
 (0)