mirror of
https://github.com/zoriya/xmlParser.git
synced 2026-05-26 23:56:32 +00:00
Handling childs
This commit is contained in:
@@ -47,4 +47,35 @@ Test(xml, withnext)
|
||||
cr_assert_eq(n->next->child, NULL);
|
||||
cr_assert_eq(n->next->properties, NULL);
|
||||
cr_assert_eq(n->next->next, NULL);
|
||||
}
|
||||
|
||||
Test(xml, withchild)
|
||||
{
|
||||
char *xml = strdup("<yes><nop/></yes>");
|
||||
node *n = xml_parsenode(&xml);
|
||||
|
||||
cr_assert_str_eq(n->name, "yes");
|
||||
cr_assert_eq(n->next, NULL);
|
||||
cr_assert_eq(n->properties, NULL);
|
||||
cr_assert_eq(n->properties->next, NULL);
|
||||
cr_assert_str_eq(n->child->name, "nop");
|
||||
cr_assert_eq(n->child->child, NULL);
|
||||
cr_assert_eq(n->child->properties, NULL);
|
||||
cr_assert_eq(n->child->next, NULL);
|
||||
}
|
||||
|
||||
Test(xml, withchildwparams)
|
||||
{
|
||||
char *xml = strdup("<yes params=\"Test\"><nop/></yes>");
|
||||
node *n = xml_parsenode(&xml);
|
||||
|
||||
cr_assert_str_eq(n->name, "yes");
|
||||
cr_assert_eq(n->next, NULL);
|
||||
cr_assert_str_eq(n->properties->key, "params");
|
||||
cr_assert_str_eq(n->properties->value, "Test");
|
||||
cr_assert_eq(n->properties->next, NULL);
|
||||
cr_assert_str_eq(n->child->name, "nop");
|
||||
cr_assert_eq(n->child->child, NULL);
|
||||
cr_assert_eq(n->child->properties, NULL);
|
||||
cr_assert_eq(n->child->next, NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user