Bugfix: DefaultIfMissing and XML arrays; #367 (#371)

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2025-03-02 01:25:33 +08:00
committed by GitHub
parent 37dbcef95a
commit 1da93be27f
2 changed files with 38 additions and 6 deletions
+24
View File
@@ -0,0 +1,24 @@
#include <cassert>
#include <iostream>
#include <rfl.hpp>
#include <rfl/json.hpp>
#include <string>
#include <vector>
#include "write_and_read.hpp"
namespace test_default_if_missing {
struct Person {
std::string name;
std::vector<std::string> children;
};
TEST(xml, test_default_if_missing) {
const auto homer =
Person{.name = "Homer",
.children = std::vector<std::string>({"Bart", "Lisa", "Maggie"})};
write_and_read<"Person", rfl::DefaultIfMissing>(homer);
}
} // namespace test_default_if_missing