diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index f74a3b8..b1f83e3 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -724,3 +724,27 @@ TEST_XML_FLAGS(dom_offset_debug, "pcdataoffset_debug() == 33); CHECK((cit++)->offset_debug() == 48); } + +TEST_XML(dom_node_wildcard_cset, "") +{ + xml_node node = doc.child("node"); + + CHECK(node.attribute_w("[A-Z]").as_int() == 0); + CHECK(node.attribute_w("[a-z]").as_int() == 1); + CHECK(node.attribute_w("[A-z]").as_int() == 1); + CHECK(node.attribute_w("[z-a]").as_int() == 0); + CHECK(node.attribute_w("[a-zA-Z]").as_int() == 1); + CHECK(node.attribute_w("[!A-Z]").as_int() == 1); + CHECK(node.attribute_w("[!A-Za-z]").as_int() == 0); +} + +TEST_XML(dom_node_wildcard_star, "") +{ + xml_node node = doc.child("node"); + + CHECK(node.attribute_w("*").as_int() == 1); + CHECK(node.attribute_w("?d*").as_int() == 1); + CHECK(node.attribute_w("?c*").as_int() == 0); + CHECK(node.attribute_w("*?*c*").as_int() == 0); + CHECK(node.attribute_w("*?*d*").as_int() == 1); +} 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("g;&#ab;"", parse_minimal | parse_escapes)); CHECK_STRING(doc.child_value("node"), "g;&#ab;""); + + CHECK(!doc.load("", parse_minimal | parse_declaration).status == status_bad_attribute); } + +TEST(parse_doctype_skip) +{ + xml_document doc; + CHECK(doc.load("") && !doc.first_child()); + CHECK(doc.load("") && !doc.first_child()); + CHECK(doc.load("") && !doc.first_child()); + CHECK(doc.load("") && !doc.first_child()); + CHECK(doc.load("") && !doc.first_child()); + CHECK(doc.load("]>") && !doc.first_child()); + + CHECK(doc.load("]>")); + CHECK_NODE(doc, ""); +} + +TEST(parse_doctype_error) +{ + xml_document doc; + CHECK(doc.load("").status == status_bad_doctype); +}