diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2024-01-20 15:35:36 +0100 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2024-01-20 15:35:36 +0100 |
commit | f5d0b7438be4f70a17841e7735a82d612d2ba596 (patch) | |
tree | e58d4cac5e459321abfe2161786c4bcd8ebdfa9f /source/tests | |
parent | b9c44821df36c488b7ead015110edd309b614fb4 (diff) | |
download | kit-f5d0b7438be4f70a17841e7735a82d612d2ba596.zip |
xml: property
Diffstat (limited to 'source/tests')
-rw-r--r-- | source/tests/xml.test.c | 19 |
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 |