Commit de03ad86 authored by Dominik Charousset's avatar Dominik Charousset Committed by Samir Halilcevic

Implement regression test for GH-1427

parent 15ab3fd7
......@@ -769,4 +769,19 @@ end object)_";
}
}
TEST_CASE("GH-1427 regression") {
struct opt_test {
std::optional<int> val;
};
auto x = opt_test{};
CHECK(f.object(x).fields(f.field("val", x.val).fallback(std::nullopt)));
CHECK(!f.get_error());
std::string baseline = R"_(
begin object anonymous
begin optional field val
end field
end object)_";
CHECK_EQ(f.log, baseline);
}
END_FIXTURE_SCOPE()
......@@ -808,5 +808,19 @@ end object)_";
}
}
}
TEST_CASE("GH-1427 regression") {
struct opt_test {
std::optional<int> val;
};
auto x = opt_test{};
CHECK(f.object(x).fields(f.field("val", x.val).fallback(std::nullopt)));
CHECK(!f.get_error());
std::string baseline = R"_(
begin object anonymous
begin optional field val
end field
end object)_";
CHECK_EQ(f.log, baseline);
}
END_FIXTURE_SCOPE()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment