diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-11-07 21:02:44 +0100 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-11-07 21:02:44 +0100 |
commit | c74dc3360470dd68646dbce80d9d088d84946610 (patch) | |
tree | ff8402620024cd78f71004d4aa21013f7193c2dc /tests | |
parent | 5cad3652d934ded5a3d5c423ca40f71c7b4661d8 (diff) | |
parent | 4c57d6f6fc856767c32872f644321a53157107cd (diff) |
Merge branch 'master' into compact
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_dom_traverse.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index 83afec8..721a079 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -924,6 +924,43 @@ TEST_XML_FLAGS(dom_offset_debug, "<?xml?><!DOCTYPE><?pi?><!--comment--><node>pcd CHECK((cit++)->offset_debug() == 58); } +TEST(dom_offset_debug_encoding) +{ + char buf[] = { 0, '<', 0, 'n', 0, '/', 0, '>' }; + + xml_document doc; + CHECK(doc.load_buffer(buf, sizeof(buf))); + + CHECK(doc.offset_debug() == 0); + CHECK(doc.first_child().offset_debug() == 1); +} + +TEST_XML(dom_offset_debug_append, "<node/>") +{ + xml_node c1 = doc.first_child(); + xml_node c2 = doc.append_child(STR("node")); + xml_node c3 = doc.append_child(node_pcdata); + + CHECK(doc.offset_debug() == 0); + CHECK(c1.offset_debug() == 1); + CHECK(c2.offset_debug() == -1); + CHECK(c3.offset_debug() == -1); + + c1.set_name(STR("nodenode")); + CHECK(c1.offset_debug() == -1); +} + +TEST_XML(dom_offset_debug_append_buffer, "<node/>") +{ + CHECK(doc.offset_debug() == 0); + CHECK(doc.first_child().offset_debug() == 1); + + CHECK(doc.append_buffer("<node/>", 7)); + CHECK(doc.offset_debug() == -1); + CHECK(doc.first_child().offset_debug() == -1); + CHECK(doc.last_child().offset_debug() == -1); +} + TEST_XML(dom_internal_object, "<node attr='value'>value</node>") { xml_node node = doc.child(STR("node")); |