Skip to content

Commit

Permalink
Fix example and test compiled warnings and error in MSVC. (#428)
Browse files Browse the repository at this point in the history
* Fix example and test compiled warnings and error in MSVC.
  • Loading branch information
gwankyun authored Apr 27, 2024
1 parent c39022e commit 5965670
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@
add_executable(example example.cpp)
target_link_libraries(example cxxopts)

set_property(TARGET example PROPERTY CXX_STANDARD 17)
target_compile_features(example PRIVATE cxx_std_17)
target_compile_options(example PRIVATE
"$<$<CXX_COMPILER_ID:MSVC>:/utf-8;>")
6 changes: 3 additions & 3 deletions test/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,11 +848,11 @@ TEST_CASE("Optional value", "[optional]")

CHECK(result.as_optional<int>("int"));
CHECK(result.as_optional<float>("float"));
CHECK(result.as_optional<string>("string"));
CHECK(result.as_optional<std::string>("string"));

CHECK(*result.as_optional<int>("int") == 42);
CHECK(*result.as_optional<float>("float") == 3.141);
CHECK(*result.as_optional<string>("string") == "Hello");
CHECK(*result.as_optional<std::string>("string") == "Hello");
}

SECTION("Unavailable") {
Expand All @@ -866,7 +866,7 @@ TEST_CASE("Optional value", "[optional]")

CHECK(!result.as_optional<int>("int"));
CHECK(!result.as_optional<float>("float"));
CHECK(!result.as_optional<string>("string"));
CHECK(!result.as_optional<std::string>("string"));
}

}
Expand Down

0 comments on commit 5965670

Please sign in to comment.