File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -735,5 +735,27 @@ TEST_CASE("test_optional_conversion_via_macro")
735735 CHECK (v2 == v);
736736 }
737737}
738+
739+ TEST_CASE (" test_optional_conversion_via_find" )
740+ {
741+ {
742+ const toml::value v (toml::table{
743+ {" foo" , toml::value (toml::table{{" a" , 42 }}) }
744+ });
745+
746+ const auto foo = toml::find<extlib4::foo>(v, " foo" );
747+ CHECK (foo.a .value () == 42 );
748+ CHECK (foo.b == std::nullopt );
749+ }
750+ {
751+ const toml::ordered_value v (toml::ordered_table{
752+ { " foo" , toml::ordered_value (toml::ordered_table{{" b" , " baz" }}) }
753+ });
754+
755+ const auto foo = toml::find<extlib4::foo>(v, " foo" );
756+ CHECK (foo.a == std::nullopt );
757+ CHECK (foo.b .value () == " baz" );
758+ }
759+ }
738760#endif // TOML11_HAS_OPTIONAL
739761#endif // TOML11_WITHOUT_DEFINE_NON_INTRUSIVE
You can’t perform that action at this time.
0 commit comments