Skip to content

Commit 37057bd

Browse files
committed
add test for template class
1 parent 0a782e4 commit 37057bd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/test_xml.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,28 @@ TEST_CASE("simple test") {
5555
}
5656
}
5757

58+
template <class T>
59+
struct Haha {
60+
std::string msg;
61+
YLT_REFL(Haha, msg);
62+
};
63+
64+
template <typename T>
65+
inline constexpr std::string_view get_alias_struct_name(Haha<T> *) {
66+
return "haha";
67+
}
68+
69+
TEST_CASE("template class test") {
70+
Haha<int> ha{"test"};
71+
std::string ss;
72+
iguana::to_xml(ha, ss);
73+
std::cout << ss << "\n";
74+
75+
Haha<int> ha1{};
76+
iguana::from_xml(ha1, ss);
77+
CHECK(ha1.msg == ha.msg);
78+
}
79+
5880
struct optional_t {
5981
int a;
6082
std::optional<int> b;

0 commit comments

Comments
 (0)