diff options
author | sanine <sanine.not@pm.me> | 2023-02-03 23:16:18 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-02-03 23:16:18 -0600 |
commit | 414bc3c6db05ec6d5127967eae39dbaa7f48ad2c (patch) | |
tree | 714c87d7d7963e20f9311a34968bab252159ea34 /src/xml/xml.test.c | |
parent | 1b4564c02380d10f7f8630d73441e7f9aa83c812 (diff) |
implement kai_tag_get_attr
Diffstat (limited to 'src/xml/xml.test.c')
-rw-r--r-- | src/xml/xml.test.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/xml/xml.test.c b/src/xml/xml.test.c new file mode 100644 index 0000000..acee4b4 --- /dev/null +++ b/src/xml/xml.test.c @@ -0,0 +1,34 @@ +#include <string.h> + +#include <kalmia.h> +#include "xml.h" +#include "test/test.h" + + +LILY_FILE_BEGIN(xml_suite) + + +LILY_TEST("get xml attributes") +{ + struct kai_tag_t *t = kai_parse_string( + "<tag attr1=\"hello\" attr2=\"world\"></tag>" + ); + + char *attr1 = kai_tag_get_attr(t, "attr1"); + REQUIRE_NEQ(attr1, NULL, "%p"); + CHECK_EQS(attr1, "hello"); + + char *attr2 = kai_tag_get_attr(t, "attr2"); + REQUIRE_NEQ(attr2, NULL, "%p"); + CHECK_EQS(attr2, "world"); + + char *attr3 = kai_tag_get_attr(t, "attr3"); + CHECK_EQ(attr3, NULL, "%p"); + + kai_tag_destroy(t); +} +#include LILY_PUSH_TEST() + + +#define LILY_FILE_END +#include LILY_REGISTER_TESTS() |