summaryrefslogtreecommitdiff
path: root/source/tests
diff options
context:
space:
mode:
Diffstat (limited to 'source/tests')
-rw-r--r--source/tests/xml.test.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/tests/xml.test.c b/source/tests/xml.test.c
index 4c72d28..1534030 100644
--- a/source/tests/xml.test.c
+++ b/source/tests/xml.test.c
@@ -406,4 +406,23 @@ TEST("xml full text") {
is_destroy(is);
}
+TEST("xml property") {
+ is_handle_t is = IS_WRAP_STRING(
+ SZ("<tag foo=\"123\" bar=\"456\" />"));
+ xml_parse_result_t res = xml_parse(is, NULL);
+
+ REQUIRE_EQ(res.status, KIT_OK);
+
+ if (res.status == KIT_OK) {
+ REQUIRE_EQ(xml_has_property(&res.xml, SZ("foo")), 1);
+ REQUIRE_EQ(xml_has_property(&res.xml, SZ("bar")), 1);
+ REQUIRE_EQ(xml_has_property(&res.xml, SZ("buz")), 0);
+ REQUIRE(AR_EQUAL(xml_property(&res.xml, SZ("foo")), SZ("123")));
+ REQUIRE(AR_EQUAL(xml_property(&res.xml, SZ("bar")), SZ("456")));
+ xml_destroy(&res.xml);
+ }
+
+ is_destroy(is);
+}
+
#undef KIT_TEST_FILE