Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix example and test compiled warnings and error in MSVC. #428

Merged
merged 2 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading