From f7aa65db8a13d32da0586c125f6b9b67460af374 Mon Sep 17 00:00:00 2001 From: Stephan Beyer Date: Sun, 24 Jan 2016 14:03:02 +0100 Subject: Fix whitespace issues Git warns when it finds "whitespace errors". This commit gets rid of these whitespace errors for code and adoc files. --- tests/main.cpp | 12 +++---- tests/test.hpp | 2 +- tests/test_document.cpp | 4 +-- tests/test_dom_modify.cpp | 76 +++++++++++++++++++++--------------------- tests/test_dom_text.cpp | 6 ++-- tests/test_dom_traverse.cpp | 26 +++++++-------- tests/test_memory.cpp | 2 +- tests/test_parse.cpp | 8 ++--- tests/test_xpath.cpp | 4 +-- tests/test_xpath_api.cpp | 10 +++--- tests/test_xpath_functions.cpp | 58 ++++++++++++++++---------------- tests/test_xpath_operators.cpp | 6 ++-- tests/test_xpath_variables.cpp | 2 +- tests/test_xpath_xalan_1.cpp | 2 +- tests/writer_string.hpp | 2 +- 15 files changed, 110 insertions(+), 110 deletions(-) (limited to 'tests') diff --git a/tests/main.cpp b/tests/main.cpp index 00016a6..8eb55ed 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -45,7 +45,7 @@ static void* custom_allocate(size_t size) g_memory_total_size += memory_size(ptr); g_memory_total_count++; - + return ptr; } } @@ -68,7 +68,7 @@ static void custom_deallocate(void* ptr) g_memory_total_size -= memory_size(ptr); g_memory_total_count--; - + memory_deallocate(ptr); } @@ -105,9 +105,9 @@ static bool run_test(test_runner* test, const char* test_name, pugi::allocation_ g_memory_fail_triggered = false; test_runner::_memory_fail_threshold = 0; test_runner::_memory_fail_triggered = false; - + pugi::set_memory_management_functions(allocate, custom_deallocate); - + #ifdef _MSC_VER # pragma warning(push) # pragma warning(disable: 4611) // interaction between _setjmp and C++ object destruction is non-portable @@ -115,7 +115,7 @@ static bool run_test(test_runner* test, const char* test_name, pugi::allocation_ #endif volatile int result = setjmp(test_runner::_failure_buffer); - + #ifdef _MSC_VER # pragma warning(pop) #endif @@ -177,7 +177,7 @@ int main(int, char** argv) temp.erase((slash != std::string::npos) ? slash + 1 : 0); test_runner::_temp_path = temp.c_str(); - + replace_memory_management(); unsigned int total = 0; diff --git a/tests/test.hpp b/tests/test.hpp index fad555d..e700826 100644 --- a/tests/test.hpp +++ b/tests/test.hpp @@ -157,7 +157,7 @@ struct dummy_fixture {}; #if (defined(_MSC_VER) && _MSC_VER == 1200) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER == 800) || defined(__BORLANDC__) // NaN comparison on MSVC6 is incorrect, see http://www.nabble.com/assertDoubleEquals,-NaN---Microsoft-Visual-Studio-6-td9137859.html // IC8 and BCC are also affected by the same bug -# define MSVC6_NAN_BUG +# define MSVC6_NAN_BUG #endif inline wchar_t wchar_cast(unsigned int value) diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 8573ce3..eba2fd4 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -109,7 +109,7 @@ TEST(document_load_stream_error) std::ifstream fs("filedoesnotexist"); CHECK(doc.load(fs).status == status_io_error); - + std::istringstream iss(""); test_runner::_memory_fail_threshold = 1; CHECK_ALLOC_FAIL(CHECK(doc.load(iss).status == status_out_of_memory)); @@ -499,7 +499,7 @@ TEST_XML(document_save_declaration_latin1, "") struct temp_file { char path[512]; - + temp_file() { static int index = 0; diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp index e84f098..67d550b 100644 --- a/tests/test_dom_modify.cpp +++ b/tests/test_dom_modify.cpp @@ -74,7 +74,7 @@ TEST_XML(dom_attr_set_value, "") TEST_XML(dom_attr_assign_llong, "") { xml_node node = doc.child(STR("node")); - + node.append_attribute(STR("attr1")) = -9223372036854775807ll; node.append_attribute(STR("attr2")) = -9223372036854775807ll - 1; xml_attribute() = -9223372036854775807ll - 1; @@ -89,7 +89,7 @@ TEST_XML(dom_attr_assign_llong, "") TEST_XML(dom_attr_set_value_llong, "") { xml_node node = doc.child(STR("node")); - + CHECK(node.append_attribute(STR("attr1")).set_value(-9223372036854775807ll)); CHECK(node.append_attribute(STR("attr2")).set_value(-9223372036854775807ll - 1)); CHECK(!xml_attribute().set_value(-9223372036854775807ll - 1)); @@ -158,7 +158,7 @@ TEST_XML(dom_node_prepend_attribute, "") { CHECK(xml_node().prepend_attribute(STR("a")) == xml_attribute()); CHECK(doc.prepend_attribute(STR("a")) == xml_attribute()); - + xml_attribute a1 = doc.child(STR("node")).prepend_attribute(STR("a1")); CHECK(a1); a1 = STR("v1"); @@ -178,7 +178,7 @@ TEST_XML(dom_node_append_attribute, "") { CHECK(xml_node().append_attribute(STR("a")) == xml_attribute()); CHECK(doc.append_attribute(STR("a")) == xml_attribute()); - + xml_attribute a1 = doc.child(STR("node")).append_attribute(STR("a1")); CHECK(a1); a1 = STR("v1"); @@ -206,7 +206,7 @@ TEST_XML(dom_node_insert_attribute_after, " CHECK(node.insert_attribute_after(STR("a"), xml_attribute()) == xml_attribute()); CHECK(node.insert_attribute_after(STR("a"), a2) == xml_attribute()); - + xml_attribute a3 = node.insert_attribute_after(STR("a3"), a1); CHECK(a3 && a3 != a2 && a3 != a1); a3 = STR("v3"); @@ -236,7 +236,7 @@ TEST_XML(dom_node_insert_attribute_before, "")); } @@ -296,7 +296,7 @@ TEST_XML(dom_node_append_copy_attribute, " CHECK(xml_node().append_copy(doc.child(STR("node")).attribute(STR("a1"))) == xml_attribute()); CHECK(doc.append_copy(doc.child(STR("node")).attribute(STR("a1"))) == xml_attribute()); CHECK(doc.child(STR("node")).append_copy(xml_attribute()) == xml_attribute()); - + xml_node node = doc.child(STR("node")); xml_node child = node.child(STR("child")); @@ -316,13 +316,13 @@ TEST_XML(dom_node_append_copy_attribute, " a3.set_name(STR("a3")); a3 = STR("v3"); - + a4.set_name(STR("a4")); a4 = STR("v4"); - + a5.set_name(STR("a5")); a5 = STR("v5"); - + CHECK_NODE(doc, STR("")); } @@ -339,7 +339,7 @@ TEST_XML(dom_node_insert_copy_after_attribute, "")); } @@ -378,7 +378,7 @@ TEST_XML(dom_node_insert_copy_before_attribute, "< CHECK(node.insert_copy_before(a1, xml_attribute()) == xml_attribute()); CHECK(node.insert_copy_before(xml_attribute(), a1) == xml_attribute()); CHECK(node.insert_copy_before(a2, a2) == xml_attribute()); - + xml_attribute a3 = node.insert_copy_before(a1, a1); CHECK(a3 && a3 != a2 && a3 != a1); @@ -394,13 +394,13 @@ TEST_XML(dom_node_insert_copy_before_attribute, "< a3.set_name(STR("a3")); a3 = STR("v3"); - + a4.set_name(STR("a4")); a4 = STR("v4"); - + a5.set_name(STR("a5")); a5 = STR("v5"); - + CHECK_NODE(doc, STR("")); } @@ -408,7 +408,7 @@ TEST_XML(dom_node_remove_attribute, "") CHECK(attr1.next_attribute() == attr2); CHECK(attr2.next_attribute() == xml_attribute()); - + CHECK(attr1.previous_attribute() == xml_attribute()); CHECK(attr2.previous_attribute() == attr1); - + CHECK(xml_attribute().next_attribute() == xml_attribute()); CHECK(xml_attribute().previous_attribute() == xml_attribute()); } @@ -497,7 +497,7 @@ TEST_XML_FLAGS(dom_node_type, "pcdata CHECK((it++)->type() == node_element); xml_node_iterator cit = doc.child(STR("node")).begin(); - + CHECK((cit++)->type() == node_pcdata); CHECK((cit++)->type() == node_cdata); } @@ -516,7 +516,7 @@ TEST_XML_FLAGS(dom_node_name_value, "") TEST_XML(dom_node_path, "text") { CHECK(xml_node().path() == STR("")); - + CHECK(doc.path() == STR("")); CHECK(doc.child(STR("node")).path() == STR("/node")); CHECK(doc.child(STR("node")).child(STR("child1")).path() == STR("/node/child1")); CHECK(doc.child(STR("node")).child(STR("child1")).child(STR("child2")).path() == STR("/node/child1/child2")); CHECK(doc.child(STR("node")).child(STR("child1")).first_child().path() == STR("/node/child1/")); - + CHECK(doc.child(STR("node")).child(STR("child1")).path('\\') == STR("\\node\\child1")); } #endif @@ -743,7 +743,7 @@ TEST_XML(dom_node_first_element_by_path, "texttextpcd CHECK((it++)->offset_debug() == 38); xml_node_iterator cit = doc.child(STR("node")).begin(); - + CHECK((cit++)->offset_debug() == 43); CHECK((cit++)->offset_debug() == 58); } @@ -966,7 +966,7 @@ TEST_XML(dom_internal_object, "value") xml_node node = doc.child(STR("node")); xml_attribute attr = node.first_attribute(); xml_node value = node.first_child(); - + CHECK(xml_node().internal_object() == 0); CHECK(xml_attribute().internal_object() == 0); @@ -988,7 +988,7 @@ TEST_XML(dom_hash_value, "value") xml_node node = doc.child(STR("node")); xml_attribute attr = node.first_attribute(); xml_node value = node.first_child(); - + CHECK(xml_node().hash_value() == 0); CHECK(xml_attribute().hash_value() == 0); diff --git a/tests/test_memory.cpp b/tests/test_memory.cpp index 85d6e86..14c9aff 100644 --- a/tests/test_memory.cpp +++ b/tests/test_memory.cpp @@ -48,7 +48,7 @@ TEST(memory_custom_memory_management) CHECK(page_allocs == 0 && page_deallocs == 0); CHECK(doc.load_string(STR(""))); - + CHECK(page_allocs == 1 && page_deallocs == 0); // modify document (no new page) diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp index 47f774e..68fd217 100644 --- a/tests/test_parse.cpp +++ b/tests/test_parse.cpp @@ -82,7 +82,7 @@ TEST(parse_pi_error) CHECK(doc.load_string(STR(""), parse_fragment | parse_pi).status == status_bad_pi); CHECK(doc.load_string(STR(""), parse_fragment | parse_pi).status == status_bad_pi); CHECK(doc.load_string(STR(""), parse_fragment | parse_pi).status == status_bad_pi); @@ -235,9 +235,9 @@ TEST(parse_ws_pcdata_skip) CHECK(!doc.first_child()); CHECK(doc.load_string(STR(" "), parse_minimal)); - + xml_node root = doc.child(STR("root")); - + CHECK(root.first_child() == root.last_child()); CHECK(!root.first_child().first_child()); } @@ -855,7 +855,7 @@ TEST(parse_declaration_error) CHECK(doc.load_string(STR(""), flags).status == status_bad_pi); CHECK(doc.load_string(STR(""), flags).status == status_bad_pi); } - + CHECK(doc.load_string(STR(""), parse_fragment | parse_declaration).status == status_bad_attribute); CHECK(doc.load_string(STR(""), parse_fragment | parse_declaration).status == status_bad_pi); } diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp index 57fa95b..33c1696 100644 --- a/tests/test_xpath.cpp +++ b/tests/test_xpath.cpp @@ -196,7 +196,7 @@ TEST(xpath_long_numbers_parse) { const pugi::char_t* str_flt_max = STR("340282346638528860000000000000000000000"); const pugi::char_t* str_flt_max_dec = STR("340282346638528860000000000000000000000.000000"); - + const pugi::char_t* str_dbl_max = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); const pugi::char_t* str_dbl_max_dec = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000"); @@ -225,7 +225,7 @@ TEST(xpath_long_numbers_stringize) { const pugi::char_t* str_flt_max = STR("340282346638528860000000000000000000000"); const pugi::char_t* str_flt_max_dec = STR("340282346638528860000000000000000000000.000000"); - + const pugi::char_t* str_dbl_max = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"); const pugi::char_t* str_dbl_max_dec = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000"); diff --git a/tests/test_xpath_api.cpp b/tests/test_xpath_api.cpp index e53c25a..ef7d4b2 100644 --- a/tests/test_xpath_api.cpp +++ b/tests/test_xpath_api.cpp @@ -31,12 +31,12 @@ TEST_XML(xpath_api_select_node, "" CHECK(n2.node().attribute(STR("id")).as_int() == 1); xpath_node n3 = doc.select_node(STR("node/bar")); - + CHECK(!n3); xpath_node n4 = doc.select_node(STR("node/head/following-sibling::foo")); xpath_node n5 = doc.select_node(STR("node/tail/preceding-sibling::foo")); - + CHECK(n4.node().attribute(STR("id")).as_int() == 1); CHECK(n5.node().attribute(STR("id")).as_int() == 1); } @@ -258,7 +258,7 @@ TEST(xpath_api_evaluate_string) // test for just enough space std::basic_string s1 = base; CHECK(q.evaluate_string(&s1[0], 11, xml_node()) == 11 && memcmp(&s1[0], STR("0123456789\0xxxxx"), 16 * sizeof(char_t)) == 0); - + // test for just not enough space std::basic_string s2 = base; CHECK(q.evaluate_string(&s2[0], 10, xml_node()) == 11 && memcmp(&s2[0], STR("012345678\0xxxxxx"), 16 * sizeof(char_t)) == 0); @@ -292,7 +292,7 @@ TEST(xpath_api_return_type) TEST(xpath_api_query_bool) { xpath_query q(STR("node")); - + CHECK(q); CHECK((!q) == false); } @@ -301,7 +301,7 @@ TEST(xpath_api_query_bool) TEST(xpath_api_query_bool_fail) { xpath_query q(STR("")); - + CHECK((q ? true : false) == false); CHECK((!q) == true); } diff --git a/tests/test_xpath_functions.cpp b/tests/test_xpath_functions.cpp index eb43bb5..211dbfb 100644 --- a/tests/test_xpath_functions.cpp +++ b/tests/test_xpath_functions.cpp @@ -6,7 +6,7 @@ TEST_XML(xpath_number_number, "123") { xml_node c; xml_node n = doc.child(STR("node")).first_child(); - + // number with 0 arguments CHECK_XPATH_NUMBER_NAN(c, STR("number()")); CHECK_XPATH_NUMBER(n, STR("number()"), 123); @@ -35,7 +35,7 @@ TEST_XML(xpath_number_number, "123") // number with 1 number argument CHECK_XPATH_NUMBER(c, STR("number(1)"), 1); - + // number with 2 arguments CHECK_XPATH_FAIL(STR("number(1, 2)")); } @@ -44,21 +44,21 @@ TEST_XML(xpath_number_sum, "123789") { xml_node c; xml_node n = doc.child(STR("node")); - + // sum with 0 arguments CHECK_XPATH_FAIL(STR("sum()")); // sum with 1 argument CHECK_XPATH_NUMBER(c, STR("sum(.)"), 0); CHECK_XPATH_NUMBER(n, STR("sum(.)"), 123789); // 123 .. 789 - + CHECK_XPATH_NUMBER(n, STR("sum(./descendant-or-self::node())"), 125490); // node + 123 + child + 789 = 123789 + 123 + 789 + 789 = 125490 CHECK_XPATH_NUMBER(n, STR("sum(.//node())"), 1701); // 123 + child + 789 = 123 + 789 + 789 CHECK_XPATH_NUMBER_NAN(doc.last_child(), STR("sum(.)")); // sum with 2 arguments CHECK_XPATH_FAIL(STR("sum(1, 2)")); - + // sum with 1 non-node-set argument CHECK_XPATH_FAIL(STR("sum(1)")); } @@ -155,7 +155,7 @@ TEST(xpath_number_round) TEST_XML(xpath_boolean_boolean, "") { xml_node c; - + // boolean with 0 arguments CHECK_XPATH_FAIL(STR("boolean()")); @@ -182,14 +182,14 @@ TEST_XML(xpath_boolean_boolean, "") TEST(xpath_boolean_not) { xml_node c; - + // not with 0 arguments CHECK_XPATH_FAIL(STR("not()")); // not with 1 argument CHECK_XPATH_BOOLEAN(c, STR("not(true())"), false); CHECK_XPATH_BOOLEAN(c, STR("not(false())"), true); - + // boolean with 2 arguments CHECK_XPATH_FAIL(STR("not(1, 2)")); } @@ -197,7 +197,7 @@ TEST(xpath_boolean_not) TEST(xpath_boolean_true) { xml_node c; - + // true with 0 arguments CHECK_XPATH_BOOLEAN(c, STR("true()"), true); @@ -208,7 +208,7 @@ TEST(xpath_boolean_true) TEST(xpath_boolean_false) { xml_node c; - + // false with 0 arguments CHECK_XPATH_BOOLEAN(c, STR("false()"), false); @@ -219,7 +219,7 @@ TEST(xpath_boolean_false) TEST_XML(xpath_boolean_lang, "") { xml_node c; - + // lang with 0 arguments CHECK_XPATH_FAIL(STR("lang()")); @@ -228,7 +228,7 @@ TEST_XML(xpath_boolean_lang, " \t\r\rval1 \rval2\r\nval3\ // normalize-space with 0 arguments CHECK_XPATH_STRING(c, STR("normalize-space()"), STR("")); CHECK_XPATH_STRING(n, STR("normalize-space()"), STR("val1 val2 val3 val4")); - + // normalize-space with 1 argument CHECK_XPATH_STRING(c, STR("normalize-space('')"), STR("")); CHECK_XPATH_STRING(c, STR("normalize-space('abcd')"), STR("abcd")); @@ -526,7 +526,7 @@ TEST_XML_FLAGS(xpath_string_normalize_space, " \t\r\rval1 \rval2\r\nval3\ CHECK_XPATH_STRING(c, STR("normalize-space('ab\r\n\tcd')"), STR("ab cd")); CHECK_XPATH_STRING(c, STR("normalize-space('ab cd')"), STR("ab cd")); CHECK_XPATH_STRING(c, STR("normalize-space('\07')"), STR("\07")); - + // normalize-space with 2 arguments CHECK_XPATH_FAIL(STR("normalize-space(1, 2)")); } @@ -537,13 +537,13 @@ TEST(xpath_string_translate) // translate with 0 arguments CHECK_XPATH_FAIL(STR("translate()")); - + // translate with 1 argument CHECK_XPATH_FAIL(STR("translate('a')")); // translate with 2 arguments CHECK_XPATH_FAIL(STR("translate('a', 'b')")); - + // translate with 3 arguments CHECK_XPATH_STRING(c, STR("translate('abc', '', '')"), STR("abc")); CHECK_XPATH_STRING(c, STR("translate('abc', '', 'foo')"), STR("abc")); @@ -604,7 +604,7 @@ TEST_XML(xpath_nodeset_position, "") // id with 0 arguments CHECK_XPATH_FAIL(STR("id()")); - + // id with 1 argument - no DTD => no id CHECK_XPATH_NODESET(n, STR("id('foo')")); @@ -656,7 +656,7 @@ TEST_XML_FLAGS(xpath_nodeset_local_name, "text< // local-name with 0 arguments CHECK_XPATH_STRING(c, STR("local-name()"), STR("")); CHECK_XPATH_STRING(n, STR("local-name()"), STR("node")); - + // local-name with 1 non-node-set argument CHECK_XPATH_FAIL(STR("local-name(1)")); @@ -681,7 +681,7 @@ TEST_XML_FLAGS(xpath_nodeset_namespace_uri, "te // namespace-uri with 0 arguments CHECK_XPATH_STRING(c, STR("namespace-uri()"), STR("")); CHECK_XPATH_STRING(n.child(STR("c2")).child(STR("foo:child")), STR("namespace-uri()"), STR("http://foo2")); - + // namespace-uri with 1 non-node-set argument CHECK_XPATH_FAIL(STR("namespace-uri(1)")); @@ -710,7 +710,7 @@ TEST_XML_FLAGS(xpath_nodeset_name, "text1-10.0004") CHECK_XPATH_NUMBER(doc, STR("number(4 div 10000)"), 0.0004); // +0 works around extended precision in div on x86 (this is needed for some configurations in MinGW 3.4) - CHECK_XPATH_BOOLEAN(doc, STR("(number(k) = (4 div 10000 + 0))"), true); + CHECK_XPATH_BOOLEAN(doc, STR("(number(k) = (4 div 10000 + 0))"), true); CHECK_XPATH_NUMBER(doc, STR("number(0.0001 * 4)"), 0.0004); CHECK_XPATH_BOOLEAN(doc, STR("(number(k) = (0.0001 * 4))"), true); } diff --git a/tests/writer_string.hpp b/tests/writer_string.hpp index 6bffc32..0c1089d 100644 --- a/tests/writer_string.hpp +++ b/tests/writer_string.hpp @@ -8,7 +8,7 @@ struct xml_writer_string: public pugi::xml_writer { std::string contents; - + virtual void write(const void* data, size_t size); std::string as_narrow() const; -- cgit v1.2.3