From f5d0b7438be4f70a17841e7735a82d612d2ba596 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Sat, 20 Jan 2024 15:35:36 +0100 Subject: xml: property --- source/tests/xml.test.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source/tests') 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("")); + 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 -- cgit v1.2.3