diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-10-20 20:51:20 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-10-20 20:51:20 +0000 |
commit | a837271e9d2eda42fb943a4189b9992b89ae9513 (patch) | |
tree | 95d7e37854e678961e12490dd3ca46e39917b6eb /tests/test_parse.cpp | |
parent | c026597234aa371a106409271885f0cdb3c7bae3 (diff) |
tests: Added wildcard and doctype tests
git-svn-id: http://pugixml.googlecode.com/svn/trunk@163 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_parse.cpp')
-rw-r--r-- | tests/test_parse.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp index eeabf38..81b217a 100644 --- a/tests/test_parse.cpp +++ b/tests/test_parse.cpp @@ -273,6 +273,8 @@ TEST(parse_escapes_error) xml_document doc;
CHECK(doc.load("<node>g;&#ab;"</node>", parse_minimal | parse_escapes));
CHECK_STRING(doc.child_value("node"), "g;&#ab;"");
+
+ CHECK(!doc.load("<node id='"));
}
TEST(parse_attribute_spaces)
@@ -388,6 +390,8 @@ TEST(parse_tag_error) {
xml_document doc;
CHECK(doc.load("<", parse_minimal).status == status_unrecognized_tag);
+ CHECK(doc.load("<!", parse_minimal).status == status_unrecognized_tag);
+ CHECK(doc.load("<!D", parse_minimal).status == status_unrecognized_tag);
CHECK(doc.load("<#", parse_minimal).status == status_unrecognized_tag);
CHECK(doc.load("<node#", parse_minimal).status == status_bad_start_element);
CHECK(doc.load("<node", parse_minimal).status == status_bad_start_element);
@@ -443,3 +447,30 @@ TEST(parse_declaration_error) CHECK(doc.load("<?xml version='1?>", parse_minimal | parse_declaration).status == status_bad_attribute);
}
+
+TEST(parse_doctype_skip)
+{
+ xml_document doc;
+ CHECK(doc.load("<!DOCTYPE doc>") && !doc.first_child());
+ CHECK(doc.load("<!DOCTYPE doc SYSTEM 'foo'>") && !doc.first_child());
+ CHECK(doc.load("<!DOCTYPE doc SYSTEM \"foo\">") && !doc.first_child());
+ CHECK(doc.load("<!DOCTYPE doc PUBLIC \"foo\" 'bar'>") && !doc.first_child());
+ CHECK(doc.load("<!DOCTYPE doc PUBLIC \"foo'\">") && !doc.first_child());
+ CHECK(doc.load("<!DOCTYPE doc SYSTEM 'foo' [<!ELEMENT foo 'ANY'>]>") && !doc.first_child());
+
+ CHECK(doc.load("<!DOCTYPE doc SYSTEM 'foo' [<!ELEMENT foo 'ANY'>]><node/>"));
+ CHECK_NODE(doc, "<node />");
+}
+
+TEST(parse_doctype_error)
+{
+ xml_document doc;
+ CHECK(doc.load("<!DOCTYPE").status == status_bad_doctype);
+ CHECK(doc.load("<!DOCTYPE doc").status == status_bad_doctype);
+ CHECK(doc.load("<!DOCTYPE doc SYSTEM 'foo").status == status_bad_doctype);
+ CHECK(doc.load("<!DOCTYPE doc SYSTEM \"foo").status == status_bad_doctype);
+ CHECK(doc.load("<!DOCTYPE doc PUBLIC \"foo\" 'bar").status == status_bad_doctype);
+ CHECK(doc.load("<!DOCTYPE doc PUBLIC \"foo'\"").status == status_bad_doctype);
+ CHECK(doc.load("<!DOCTYPE doc SYSTEM 'foo' [<!ELEMENT foo 'ANY").status == status_bad_doctype);
+ CHECK(doc.load("<!DOCTYPE doc SYSTEM 'foo' [<!ELEMENT foo 'ANY'>").status == status_bad_doctype);
+}
|