mirror of
https://github.com/jarro2783/cxxopts.git
synced 2026-01-18 01:11:24 +01:00
Fix example and test compiled warnings and error in MSVC. (#428)
* Fix example and test compiled warnings and error in MSVC.
This commit is contained in:
@@ -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;>")
|
||||
|
||||
@@ -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") {
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user