summaryrefslogtreecommitdiff
path: root/tests/test_parse.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-23 07:41:07 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-23 07:41:07 +0000
commit903db8682a5f14b52adec996584c70ea072619ea (patch)
treeb65c4c8bb68d7d0d77a204ca850c2d85bf7a5a6e /tests/test_parse.cpp
parentbbd75fda4618dcbef272c8e5432153992c392588 (diff)
tests: Add more tests for better coverage
More tests for out-of-memory and other edge conditions git-svn-id: https://pugixml.googlecode.com/svn/trunk@1075 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_parse.cpp')
-rw-r--r--tests/test_parse.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp
index 444a0fb..c45b783 100644
--- a/tests/test_parse.cpp
+++ b/tests/test_parse.cpp
@@ -1068,3 +1068,25 @@ TEST(parse_pcdata_gap_fragment)
CHECK(doc.load(STR("a&amp;b"), parse_fragment | parse_escapes));
CHECK_STRING(doc.text().get(), STR("a&b"));
}
+
+TEST(parse_name_end_eof)
+{
+ char_t test[] = STR("<node>");
+
+ xml_document doc;
+ CHECK(doc.load_buffer_inplace(test, 6 * sizeof(char_t)).status == status_end_element_mismatch);
+ CHECK_STRING(doc.first_child().name(), STR("node"));
+}
+
+TEST(parse_close_tag_eof)
+{
+ char_t test1[] = STR("<node></node");
+ char_t test2[] = STR("<node></nodx");
+
+ xml_document doc;
+ CHECK(doc.load_buffer_inplace(test1, 12 * sizeof(char_t)).status == status_bad_end_element);
+ CHECK_STRING(doc.first_child().name(), STR("node"));
+
+ CHECK(doc.load_buffer_inplace(test2, 12 * sizeof(char_t)).status == status_end_element_mismatch);
+ CHECK_STRING(doc.first_child().name(), STR("node"));
+}