summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-05-08 20:30:29 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-05-08 20:30:29 +0000
commit6706a3f8ba550701012bee86f6a1d60890437cdf (patch)
treefe20f69f221bca98949d159af24882bf01b92364
parent1172d9bc4a1dbb2a16513bd918ade85486f54243 (diff)
Deprecated all wildcard functions and parse_wnorm_attribute
git-svn-id: http://pugixml.googlecode.com/svn/trunk@389 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r--src/pugixml.cpp7
-rw-r--r--src/pugixml.hpp73
-rw-r--r--tests/test_deprecated.cpp135
-rw-r--r--tests/test_document.cpp7
-rw-r--r--tests/test_dom_traverse.cpp69
-rw-r--r--tests/test_parse.cpp39
6 files changed, 208 insertions, 122 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 615d7d4..59ba5d7 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -3190,7 +3190,12 @@ namespace pugi
const char_t* xml_node::child_value_w(const char_t* name) const
{
- return child_w(name).child_value();
+ if (!_root) return PUGIXML_TEXT("");
+
+ for (xml_node_struct* i = _root->first_child; i; i = i->next_sibling)
+ if (i->name && impl::strequalwild(name, i->name)) return xml_node(i).child_value();
+
+ return PUGIXML_TEXT("");
}
xml_attribute xml_node::first_attribute() const
diff --git a/src/pugixml.hpp b/src/pugixml.hpp
index 2206450..b9d385f 100644
--- a/src/pugixml.hpp
+++ b/src/pugixml.hpp
@@ -223,7 +223,12 @@ namespace pugi
* 3. Leading/trailing whitespace characters are trimmed
*
* This flag is off by default.
+ *
+ * \deprecated This flag is deprecated
*/
+#ifndef __INTEL_COMPILER
+ PUGIXML_DEPRECATED
+#endif
const unsigned int parse_wnorm_attribute = 0x0040;
/**
@@ -788,6 +793,26 @@ namespace pugi
/// \internal Get allocator
xml_allocator& get_allocator() const;
+ private:
+ template <typename OutputIterator> void all_elements_by_name_w_helper(const char_t* name, OutputIterator it) const
+ {
+ if (!_root) return;
+
+ for (xml_node node = first_child(); node; node = node.next_sibling())
+ {
+ if (node.type() == node_element)
+ {
+ if (impl::strequalwild(name, node.name()))
+ {
+ *it = node;
+ ++it;
+ }
+
+ if (node.first_child()) node.all_elements_by_name_w_helper(name, it);
+ }
+ }
+ }
+
public:
/**
* Default ctor. Constructs an empty node.
@@ -936,8 +961,10 @@ namespace pugi
*
* \param name - child name pattern
* \return child with the name that matches pattern, if any; empty node otherwise
+ *
+ * \deprecated This function is deprecated
*/
- xml_node child_w(const char_t* name) const;
+ PUGIXML_DEPRECATED xml_node child_w(const char_t* name) const;
/**
* Get attribute with the specified name
@@ -952,8 +979,10 @@ namespace pugi
*
* \param name - attribute name pattern
* \return attribute with the name that matches pattern, if any; empty attribute otherwise
+ *
+ * \deprecated This function is deprecated
*/
- xml_attribute attribute_w(const char_t* name) const;
+ PUGIXML_DEPRECATED xml_attribute attribute_w(const char_t* name) const;
/**
* Get first of following sibling nodes with the specified name
@@ -968,8 +997,10 @@ namespace pugi
*
* \param name - sibling name pattern
* \return node with the name that matches pattern, if any; empty node otherwise
+ *
+ * \deprecated This function is deprecated
*/
- xml_node next_sibling_w(const char_t* name) const;
+ PUGIXML_DEPRECATED xml_node next_sibling_w(const char_t* name) const;
/**
* Get following sibling
@@ -991,8 +1022,10 @@ namespace pugi
*
* \param name - sibling name pattern
* \return node with the name that matches pattern, if any; empty node otherwise
+ *
+ * \deprecated This function is deprecated
*/
- xml_node previous_sibling_w(const char_t* name) const;
+ PUGIXML_DEPRECATED xml_node previous_sibling_w(const char_t* name) const;
/**
* Get preceding sibling
@@ -1037,8 +1070,10 @@ namespace pugi
*
* \param name - child name pattern
* \return child value of specified child node, if any; "" otherwise
+ *
+ * \deprecated This function is deprecated
*/
- const char_t* child_value_w(const char_t* name) const;
+ PUGIXML_DEPRECATED const char_t* child_value_w(const char_t* name) const;
public:
/**
@@ -1234,24 +1269,12 @@ namespace pugi
*
* \param name - node name pattern
* \param it - output iterator (for example, std::back_insert_iterator (result of std::back_inserter))
+ *
+ * \deprecated This function is deprecated
*/
- template <typename OutputIterator> void all_elements_by_name_w(const char_t* name, OutputIterator it) const
+ template <typename OutputIterator> PUGIXML_DEPRECATED void all_elements_by_name_w(const char_t* name, OutputIterator it) const
{
- if (!_root) return;
-
- for (xml_node node = first_child(); node; node = node.next_sibling())
- {
- if (node.type() == node_element)
- {
- if (impl::strequalwild(name, node.name()))
- {
- *it = node;
- ++it;
- }
-
- if (node.first_child()) node.all_elements_by_name_w(name, it);
- }
- }
+ all_elements_by_name_w_helper(name, it);
}
/**
@@ -1344,8 +1367,10 @@ namespace pugi
* \param attr_name - pattern for attribute name of child node
* \param attr_value - pattern for attribute value of child node
* \return first matching child node, or empty node
+ *
+ * \deprecated This function is deprecated
*/
- xml_node find_child_by_attribute_w(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
+ PUGIXML_DEPRECATED xml_node find_child_by_attribute_w(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
/**
* Find child node that has specified attribute
@@ -1362,8 +1387,10 @@ namespace pugi
* \param attr_name - pattern for attribute name of child node
* \param attr_value - pattern for attribute value of child node
* \return first matching child node, or empty node
+ *
+ * \deprecated This function is deprecated
*/
- xml_node find_child_by_attribute_w(const char_t* attr_name, const char_t* attr_value) const;
+ PUGIXML_DEPRECATED xml_node find_child_by_attribute_w(const char_t* attr_name, const char_t* attr_value) const;
#ifndef PUGIXML_NO_STL
/**
diff --git a/tests/test_deprecated.cpp b/tests/test_deprecated.cpp
index 691b40a..95e78f5 100644
--- a/tests/test_deprecated.cpp
+++ b/tests/test_deprecated.cpp
@@ -6,6 +6,9 @@
#include "writer_string.hpp"
+#include <vector>
+#include <iterator>
+
#ifdef _MSC_VER
# pragma warning(disable: 4996)
#endif
@@ -59,3 +62,135 @@ TEST(as_utf16)
#endif
}
#endif
+
+// wildcard functions
+TEST_XML(dom_node_child_w, "<node><child1/><child2/></node>")
+{
+ CHECK(doc.child_w(STR("n?de")) == doc.child(STR("node")));
+ CHECK(doc.child_w(STR("n[az]de")) == xml_node());
+ CHECK(doc.child_w(STR("n[aoz]de")) == doc.child(STR("node")));
+ CHECK(doc.child_w(STR("*e")) == doc.child(STR("node")));
+ CHECK(doc.child(STR("node")).child_w(STR("*l?[23456789]*")) == doc.child(STR("node")).child(STR("child2")));
+}
+
+TEST_XML(dom_node_attribute_w, "<node attr1='0' attr2='1'/>")
+{
+ xml_node node = doc.child(STR("node"));
+
+ CHECK(node.attribute_w(STR("*tt?[23456789]*")) == node.attribute(STR("attr2")));
+ CHECK(node.attribute_w(STR("?")) == xml_attribute());
+}
+
+TEST_XML(dom_node_next_previous_sibling_w, "<node><child1/><child2/><child3/></node>")
+{
+ CHECK(xml_node().next_sibling_w(STR("n")) == xml_node());
+ CHECK(xml_node().previous_sibling_w(STR("n")) == xml_node());
+
+ xml_node child1 = doc.child(STR("node")).child(STR("child1"));
+ xml_node child3 = doc.child(STR("node")).child(STR("child3"));
+
+ CHECK(child1.next_sibling_w(STR("*[3456789]")) == child3);
+ CHECK(child1.next_sibling_w(STR("?")) == xml_node());
+ CHECK(child3.previous_sibling_w(STR("*[3456789]")) == xml_node());
+ CHECK(child3.previous_sibling_w(STR("?")) == xml_node());
+ CHECK(child3.previous_sibling_w(STR("*1")) == child1);
+}
+
+TEST_XML(dom_node_child_value_w, "<node><novalue/><child1>value1</child1><child2>value2<n/></child2><child3><![CDATA[value3]]></child3>value4</node>")
+{
+ CHECK_STRING(xml_node().child_value_w(STR("n")), STR(""));
+
+ xml_node node = doc.child(STR("node"));
+
+ CHECK_STRING(node.child_value_w(STR("c*[23456789]")), STR("value2"));
+ CHECK_STRING(node.child_value_w(STR("*")), STR("")); // child_value(name) and child_value_w(pattern) do not continue the search if a node w/out value is found first
+}
+
+TEST_XML(dom_node_find_child_by_attribute_w, "<node><child1 attr='value1'/><child2 attr='value2'/><child2 attr='value3'/></node>")
+{
+ CHECK(xml_node().find_child_by_attribute_w(STR("name"), STR("attr"), STR("value")) == xml_node());
+ CHECK(xml_node().find_child_by_attribute_w(STR("attr"), STR("value")) == xml_node());
+
+ xml_node node = doc.child(STR("node"));
+
+ CHECK(node.find_child_by_attribute_w(STR("*"), STR("att?"), STR("val*[0123456789]")) == node.child(STR("child1")));
+ CHECK(node.find_child_by_attribute_w(STR("*"), STR("attr3"), STR("val*[0123456789]")) == xml_node());
+ CHECK(node.find_child_by_attribute_w(STR("att?"), STR("val*[0123456789]")) == node.child(STR("child1")));
+ CHECK(node.find_child_by_attribute_w(STR("attr3"), STR("val*[0123456789]")) == xml_node());
+}
+
+TEST_XML(dom_node_all_elements_by_name_w, "<node><child><child/><child/></child></node>")
+{
+ std::vector<xml_node> v;
+
+ v.clear();
+ xml_node().all_elements_by_name_w(STR("*"), std::back_inserter(v));
+ CHECK(v.empty());
+
+ v.clear();
+ doc.all_elements_by_name_w(STR("*"), std::back_inserter(v));
+ CHECK(v.size() == 4);
+ CHECK(v[0] == doc.child(STR("node")));
+ CHECK(v[1] == doc.child(STR("node")).child(STR("child")));
+ CHECK(v[2] == doc.child(STR("node")).child(STR("child")).first_child());
+ CHECK(v[3] == doc.child(STR("node")).child(STR("child")).last_child());
+}
+
+TEST_XML(dom_node_wildcard_cset, "<node c='1'/>")
+{
+ xml_node node = doc.child(STR("node"));
+
+ CHECK(node.attribute_w(STR("[A-Z]")).as_int() == 0);
+ CHECK(node.attribute_w(STR("[a-z]")).as_int() == 1);
+ CHECK(node.attribute_w(STR("[A-z]")).as_int() == 1);
+ CHECK(node.attribute_w(STR("[z-a]")).as_int() == 0);
+ CHECK(node.attribute_w(STR("[a-zA-Z]")).as_int() == 1);
+ CHECK(node.attribute_w(STR("[!A-Z]")).as_int() == 1);
+ CHECK(node.attribute_w(STR("[!A-Za-z]")).as_int() == 0);
+}
+
+TEST_XML(dom_node_wildcard_star, "<node cd='1'/>")
+{
+ xml_node node = doc.child(STR("node"));
+
+ CHECK(node.attribute_w(STR("*")).as_int() == 1);
+ CHECK(node.attribute_w(STR("?d*")).as_int() == 1);
+ CHECK(node.attribute_w(STR("?c*")).as_int() == 0);
+ CHECK(node.attribute_w(STR("*?*c*")).as_int() == 0);
+ CHECK(node.attribute_w(STR("*?*d*")).as_int() == 1);
+}
+
+TEST(parse_attribute_wnorm)
+{
+ xml_document doc;
+
+ for (int eol = 0; eol < 2; ++eol)
+ for (int wconv = 0; wconv < 2; ++wconv)
+ {
+ unsigned int flags = parse_minimal | parse_wnorm_attribute | (eol ? parse_eol : 0) | (wconv ? parse_wconv_attribute : 0);
+ CHECK(doc.load(STR("<node id=' \t\r\rval1 \rval2\r\nval3\nval4\r\r'/>"), flags));
+ CHECK_STRING(doc.child(STR("node")).attribute(STR("id")).value(), STR("val1 val2 val3 val4"));
+ }
+}
+
+TEST(parse_attribute_variations_wnorm)
+{
+ xml_document doc;
+
+ for (int wnorm = 0; wnorm < 2; ++wnorm)
+ for (int eol = 0; eol < 2; ++eol)
+ for (int wconv = 0; wconv < 2; ++wconv)
+ for (int escapes = 0; escapes < 2; ++escapes)
+ {
+ unsigned int flags = parse_minimal;
+
+ flags |= (wnorm ? parse_wnorm_attribute : 0);
+ flags |= (eol ? parse_eol : 0);
+ flags |= (wconv ? parse_wconv_attribute : 0);
+ flags |= (escapes ? parse_escapes : 0);
+
+ CHECK(doc.load(STR("<node id='1'/>"), flags));
+ CHECK_STRING(doc.child(STR("node")).attribute(STR("id")).value(), STR("1"));
+ }
+}
+
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index 46f0ff4..97ba1d9 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -1,3 +1,6 @@
+#define _CRT_SECURE_NO_WARNINGS
+#define _CRT_NONSTDC_NO_DEPRECATE 0
+
#include <string.h> // because Borland's STL is braindead, we have to include <string.h> _before_ <string> in order to get memcpy
#include "common.hpp"
@@ -12,10 +15,6 @@
#include <string>
-#ifdef _MSC_VER
-#pragma warning(disable: 4996)
-#endif
-
TEST(document_create)
{
pugi::xml_document doc;
diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp
index 3d8a53f..7d04bda 100644
--- a/tests/test_dom_traverse.cpp
+++ b/tests/test_dom_traverse.cpp
@@ -1,3 +1,5 @@
+#define _CRT_SECURE_NO_WARNINGS
+
#include "common.hpp"
#include <stdio.h>
@@ -12,10 +14,6 @@
#include "helpers.hpp"
-#ifdef _MSC_VER
-#pragma warning(disable: 4996)
-#endif
-
#ifdef PUGIXML_NO_STL
template <typename I> static I move_iter(I base, int n)
{
@@ -298,12 +296,6 @@ TEST_XML(dom_node_child, "<node><child1/><child2/></node>")
CHECK(doc.child(STR("n")) == xml_node());
CHECK_NAME_VALUE(doc.child(STR("node")), STR("node"), STR(""));
CHECK(doc.child(STR("node")).child(STR("child2")) == doc.child(STR("node")).last_child());
-
- CHECK(doc.child_w(STR("n?de")) == doc.child(STR("node")));
- CHECK(doc.child_w(STR("n[az]de")) == xml_node());
- CHECK(doc.child_w(STR("n[aoz]de")) == doc.child(STR("node")));
- CHECK(doc.child_w(STR("*e")) == doc.child(STR("node")));
- CHECK(doc.child(STR("node")).child_w(STR("*l?[23456789]*")) == doc.child(STR("node")).child(STR("child2")));
}
TEST_XML(dom_node_attribute, "<node attr1='0' attr2='1'/>")
@@ -315,20 +307,15 @@ TEST_XML(dom_node_attribute, "<node attr1='0' attr2='1'/>")
CHECK(node.attribute(STR("n")) == xml_attribute());
CHECK_NAME_VALUE(node.attribute(STR("attr1")), STR("attr1"), STR("0"));
CHECK(node.attribute(STR("attr2")) == node.last_attribute());
-
- CHECK(node.attribute_w(STR("*tt?[23456789]*")) == node.attribute(STR("attr2")));
- CHECK(node.attribute_w(STR("?")) == xml_attribute());
}
TEST_XML(dom_node_next_previous_sibling, "<node><child1/><child2/><child3/></node>")
{
CHECK(xml_node().next_sibling() == xml_node());
CHECK(xml_node().next_sibling(STR("n")) == xml_node());
- CHECK(xml_node().next_sibling_w(STR("n")) == xml_node());
CHECK(xml_node().previous_sibling() == xml_node());
CHECK(xml_node().previous_sibling(STR("n")) == xml_node());
- CHECK(xml_node().previous_sibling_w(STR("n")) == xml_node());
xml_node child1 = doc.child(STR("node")).child(STR("child1"));
xml_node child2 = doc.child(STR("node")).child(STR("child2"));
@@ -345,19 +332,12 @@ TEST_XML(dom_node_next_previous_sibling, "<node><child1/><child2/><child3/></nod
CHECK(child3.previous_sibling(STR("child1")) == child1);
CHECK(child3.previous_sibling(STR("child")) == xml_node());
-
- CHECK(child1.next_sibling_w(STR("*[3456789]")) == child3);
- CHECK(child1.next_sibling_w(STR("?")) == xml_node());
- CHECK(child3.previous_sibling_w(STR("*[3456789]")) == xml_node());
- CHECK(child3.previous_sibling_w(STR("?")) == xml_node());
- CHECK(child3.previous_sibling_w(STR("*1")) == child1);
}
TEST_XML(dom_node_child_value, "<node><novalue/><child1>value1</child1><child2>value2<n/></child2><child3><![CDATA[value3]]></child3>value4</node>")
{
CHECK_STRING(xml_node().child_value(), STR(""));
CHECK_STRING(xml_node().child_value(STR("n")), STR(""));
- CHECK_STRING(xml_node().child_value_w(STR("n")), STR(""));
xml_node node = doc.child(STR("node"));
@@ -366,8 +346,6 @@ TEST_XML(dom_node_child_value, "<node><novalue/><child1>value1</child1><child2>v
CHECK_STRING(node.child(STR("child2")).child_value(), STR("value2"));
CHECK_STRING(node.child(STR("child3")).child_value(), STR("value3"));
CHECK_STRING(node.child_value(STR("child3")), STR("value3"));
- CHECK_STRING(node.child_value_w(STR("c*[23456789]")), STR("value2"));
- CHECK_STRING(node.child_value_w(STR("*")), STR("")); // child_value(name) and child_value_w(pattern) do not continue the search if a node w/out value is found first
}
TEST_XML(dom_node_first_last_attribute, "<node attr1='0' attr2='1'/>")
@@ -401,9 +379,7 @@ TEST_XML(dom_node_first_last_child, "<node><child1/><child2/></node>")
TEST_XML(dom_node_find_child_by_attribute, "<node><child1 attr='value1'/><child2 attr='value2'/><child2 attr='value3'/></node>")
{
CHECK(xml_node().find_child_by_attribute(STR("name"), STR("attr"), STR("value")) == xml_node());
- CHECK(xml_node().find_child_by_attribute_w(STR("name"), STR("attr"), STR("value")) == xml_node());
CHECK(xml_node().find_child_by_attribute(STR("attr"), STR("value")) == xml_node());
- CHECK(xml_node().find_child_by_attribute_w(STR("attr"), STR("value")) == xml_node());
xml_node node = doc.child(STR("node"));
@@ -411,11 +387,6 @@ TEST_XML(dom_node_find_child_by_attribute, "<node><child1 attr='value1'/><child2
CHECK(node.find_child_by_attribute(STR("child2"), STR("attr3"), STR("value3")) == xml_node());
CHECK(node.find_child_by_attribute(STR("attr"), STR("value2")) == node.child(STR("child2")));
CHECK(node.find_child_by_attribute(STR("attr3"), STR("value")) == xml_node());
-
- CHECK(node.find_child_by_attribute_w(STR("*"), STR("att?"), STR("val*[0123456789]")) == node.child(STR("child1")));
- CHECK(node.find_child_by_attribute_w(STR("*"), STR("attr3"), STR("val*[0123456789]")) == xml_node());
- CHECK(node.find_child_by_attribute_w(STR("att?"), STR("val*[0123456789]")) == node.child(STR("child1")));
- CHECK(node.find_child_by_attribute_w(STR("attr3"), STR("val*[0123456789]")) == xml_node());
}
TEST_XML(dom_node_all_elements_by_name, "<node><child><child/><child/></child></node>")
@@ -427,10 +398,6 @@ TEST_XML(dom_node_all_elements_by_name, "<node><child><child/><child/></child></
CHECK(v.empty());
v.clear();
- xml_node().all_elements_by_name_w(STR("*"), std::back_inserter(v));
- CHECK(v.empty());
-
- v.clear();
doc.all_elements_by_name(STR("node"), std::back_inserter(v));
CHECK(v.size() == 1 && v[0] == doc.child(STR("node")));
@@ -440,14 +407,6 @@ TEST_XML(dom_node_all_elements_by_name, "<node><child><child/><child/></child></
CHECK(v[0] == doc.child(STR("node")).child(STR("child")));
CHECK(v[1] == doc.child(STR("node")).child(STR("child")).first_child());
CHECK(v[2] == doc.child(STR("node")).child(STR("child")).last_child());
-
- v.clear();
- doc.all_elements_by_name_w(STR("*"), std::back_inserter(v));
- CHECK(v.size() == 4);
- CHECK(v[0] == doc.child(STR("node")));
- CHECK(v[1] == doc.child(STR("node")).child(STR("child")));
- CHECK(v[2] == doc.child(STR("node")).child(STR("child")).first_child());
- CHECK(v[3] == doc.child(STR("node")).child(STR("child")).last_child());
}
struct find_predicate_const
@@ -713,27 +672,3 @@ TEST_XML_FLAGS(dom_offset_debug, "<?xml?><?pi?><!--comment--><node>pcdata<![CDAT
CHECK((cit++)->offset_debug() == 33);
CHECK((cit++)->offset_debug() == 48);
}
-
-TEST_XML(dom_node_wildcard_cset, "<node c='1'/>")
-{
- xml_node node = doc.child(STR("node"));
-
- CHECK(node.attribute_w(STR("[A-Z]")).as_int() == 0);
- CHECK(node.attribute_w(STR("[a-z]")).as_int() == 1);
- CHECK(node.attribute_w(STR("[A-z]")).as_int() == 1);
- CHECK(node.attribute_w(STR("[z-a]")).as_int() == 0);
- CHECK(node.attribute_w(STR("[a-zA-Z]")).as_int() == 1);
- CHECK(node.attribute_w(STR("[!A-Z]")).as_int() == 1);
- CHECK(node.attribute_w(STR("[!A-Za-z]")).as_int() == 0);
-}
-
-TEST_XML(dom_node_wildcard_star, "<node cd='1'/>")
-{
- xml_node node = doc.child(STR("node"));
-
- CHECK(node.attribute_w(STR("*")).as_int() == 1);
- CHECK(node.attribute_w(STR("?d*")).as_int() == 1);
- CHECK(node.attribute_w(STR("?c*")).as_int() == 0);
- CHECK(node.attribute_w(STR("*?*c*")).as_int() == 0);
- CHECK(node.attribute_w(STR("*?*d*")).as_int() == 1);
-}
diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp
index 461578e..0719e5d 100644
--- a/tests/test_parse.cpp
+++ b/tests/test_parse.cpp
@@ -357,38 +357,23 @@ TEST(parse_attribute_eol_wconv)
CHECK_STRING(doc.child(STR("node")).attribute(STR("id")).value(), STR(" val1 val2 val3 val4 "));
}
-TEST(parse_attribute_wnorm)
+TEST(parse_attribute_variations)
{
xml_document doc;
for (int eol = 0; eol < 2; ++eol)
for (int wconv = 0; wconv < 2; ++wconv)
- {
- unsigned int flags = parse_minimal | parse_wnorm_attribute | (eol ? parse_eol : 0) | (wconv ? parse_wconv_attribute : 0);
- CHECK(doc.load(STR("<node id=' \t\r\rval1 \rval2\r\nval3\nval4\r\r'/>"), flags));
- CHECK_STRING(doc.child(STR("node")).attribute(STR("id")).value(), STR("val1 val2 val3 val4"));
- }
-}
-
-TEST(parse_attribute_variations)
-{
- xml_document doc;
-
- for (int wnorm = 0; wnorm < 2; ++wnorm)
- for (int eol = 0; eol < 2; ++eol)
- for (int wconv = 0; wconv < 2; ++wconv)
- for (int escapes = 0; escapes < 2; ++escapes)
- {
- unsigned int flags = parse_minimal;
-
- flags |= (wnorm ? parse_wnorm_attribute : 0);
- flags |= (eol ? parse_eol : 0);
- flags |= (wconv ? parse_wconv_attribute : 0);
- flags |= (escapes ? parse_escapes : 0);
-
- CHECK(doc.load(STR("<node id='1'/>"), flags));
- CHECK_STRING(doc.child(STR("node")).attribute(STR("id")).value(), STR("1"));
- }
+ for (int escapes = 0; escapes < 2; ++escapes)
+ {
+ unsigned int flags = parse_minimal;
+
+ flags |= (eol ? parse_eol : 0);
+ flags |= (wconv ? parse_wconv_attribute : 0);
+ flags |= (escapes ? parse_escapes : 0);
+
+ CHECK(doc.load(STR("<node id='1'/>"), flags));
+ CHECK_STRING(doc.child(STR("node")).attribute(STR("id")).value(), STR("1"));
+ }
}
TEST(parse_attribute_error)