mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-21 21:06:11 +01:00
implement stringify for std::nullopt_t
This commit is contained in:
parent
2a19ae16b8
commit
3a5cde55b7
@ -398,6 +398,12 @@ namespace Catch {
|
||||
}
|
||||
}
|
||||
};
|
||||
template <>
|
||||
struct StringMaker<std::nullopt_t> {
|
||||
static std::string convert(const std::nullopt_t&) {
|
||||
return "{ }";
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER
|
||||
|
||||
|
@ -28,4 +28,8 @@ TEST_CASE( "std::vector<std::optional<int> > -> toString", "[toString][optional]
|
||||
REQUIRE( "{ 0, { }, 2 }" == ::Catch::Detail::stringify( type{ 0, {}, 2 } ) );
|
||||
}
|
||||
|
||||
TEST_CASE( "std::nullopt -> toString", "[toString][optional][approvals]" ) {
|
||||
REQUIRE( "{ }" == ::Catch::Detail::stringify( std::nullopt ) );
|
||||
}
|
||||
|
||||
#endif // CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL
|
||||
|
Loading…
Reference in New Issue
Block a user