From 5867aff943f80f19649c7e6495765af0cb5719b2 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Thu, 22 Jun 2017 20:41:08 -0700 Subject: tests: Make using namespace more explicit Hiding using namespace in common.hpp is somewhat surprising so remove common.hpp and move using namespace into all .cpp files that need it. --- tests/common.hpp | 8 -------- tests/helpers.hpp | 2 +- tests/test_compact.cpp | 4 +++- tests/test_deprecated.cpp | 4 +++- tests/test_document.cpp | 4 +++- tests/test_dom_modify.cpp | 4 +++- tests/test_dom_text.cpp | 4 +++- tests/test_dom_traverse.cpp | 4 +++- tests/test_header_only_1.cpp | 4 +++- tests/test_header_only_2.cpp | 4 +++- tests/test_memory.cpp | 4 +++- tests/test_parse.cpp | 4 +++- tests/test_parse_doctype.cpp | 4 +++- tests/test_unicode.cpp | 4 +++- tests/test_write.cpp | 4 +++- tests/test_xpath.cpp | 4 +++- tests/test_xpath_api.cpp | 4 +++- tests/test_xpath_functions.cpp | 4 +++- tests/test_xpath_operators.cpp | 4 +++- tests/test_xpath_parse.cpp | 4 +++- tests/test_xpath_paths.cpp | 4 +++- tests/test_xpath_paths_abbrev_w3c.cpp | 4 +++- tests/test_xpath_paths_w3c.cpp | 4 +++- tests/test_xpath_variables.cpp | 4 +++- tests/test_xpath_xalan_1.cpp | 4 +++- tests/test_xpath_xalan_2.cpp | 4 +++- tests/test_xpath_xalan_3.cpp | 4 +++- tests/test_xpath_xalan_4.cpp | 4 +++- tests/test_xpath_xalan_5.cpp | 4 +++- 29 files changed, 82 insertions(+), 36 deletions(-) delete mode 100644 tests/common.hpp diff --git a/tests/common.hpp b/tests/common.hpp deleted file mode 100644 index 35e4717..0000000 --- a/tests/common.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef HEADER_TEST_COMMON_HPP -#define HEADER_TEST_COMMON_HPP - -#include "test.hpp" - -using namespace pugi; - -#endif diff --git a/tests/helpers.hpp b/tests/helpers.hpp index 439f8ea..6dfdc4b 100644 --- a/tests/helpers.hpp +++ b/tests/helpers.hpp @@ -1,7 +1,7 @@ #ifndef HEADER_TEST_HELPERS_HPP #define HEADER_TEST_HELPERS_HPP -#include "common.hpp" +#include "test.hpp" #include diff --git a/tests/test_compact.cpp b/tests/test_compact.cpp index f5dc4ee..89bbfaa 100644 --- a/tests/test_compact.cpp +++ b/tests/test_compact.cpp @@ -1,5 +1,7 @@ #ifdef PUGIXML_COMPACT -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; static void overflow_hash_table(xml_document& doc) { diff --git a/tests/test_deprecated.cpp b/tests/test_deprecated.cpp index 55f8937..990e9ba 100644 --- a/tests/test_deprecated.cpp +++ b/tests/test_deprecated.cpp @@ -1,6 +1,8 @@ #define PUGIXML_DEPRECATED // Suppress deprecated declarations to avoid warnings -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST(document_deprecated_load) { diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 45b8536..2b4c4be 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -5,7 +5,7 @@ #include // because Borland's STL is braindead, we have to include _before_ in order to get memcpy -#include "common.hpp" +#include "test.hpp" #include "writer_string.hpp" @@ -26,6 +26,8 @@ # include // for unlink #endif +using namespace pugi; + static bool load_file_in_memory(const char* path, char*& data, size_t& size) { FILE* file = fopen(path, "rb"); diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp index c863c6f..9696827 100644 --- a/tests/test_dom_modify.cpp +++ b/tests/test_dom_modify.cpp @@ -1,4 +1,4 @@ -#include "common.hpp" +#include "test.hpp" #include #include @@ -7,6 +7,8 @@ #include #include +using namespace pugi; + TEST_XML(dom_attr_assign, "") { xml_node node = doc.child(STR("node")); diff --git a/tests/test_dom_text.cpp b/tests/test_dom_text.cpp index 8f62e49..23b41e5 100644 --- a/tests/test_dom_text.cpp +++ b/tests/test_dom_text.cpp @@ -1,9 +1,11 @@ -#include "common.hpp" +#include "test.hpp" #include "helpers.hpp" #include +using namespace pugi; + TEST_XML_FLAGS(dom_text_empty, "foo", parse_default | parse_pi) { xml_node node = doc.child(STR("node")); diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index 4dc6cda..b135674 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -2,7 +2,7 @@ #define _SCL_SECURE_NO_WARNINGS #define _SCL_SECURE_NO_DEPRECATE -#include "common.hpp" +#include "test.hpp" #include #include @@ -15,6 +15,8 @@ #include "helpers.hpp" +using namespace pugi; + #ifdef PUGIXML_NO_STL template static I move_iter(I base, int n) { diff --git a/tests/test_header_only_1.cpp b/tests/test_header_only_1.cpp index e33fd78..2e90b33 100644 --- a/tests/test_header_only_1.cpp +++ b/tests/test_header_only_1.cpp @@ -1,12 +1,14 @@ #define PUGIXML_HEADER_ONLY #define pugi pugih -#include "common.hpp" +#include "test.hpp" // Check header guards #include "../src/pugixml.hpp" #include "../src/pugixml.hpp" +using namespace pugi; + TEST(header_only_1) { xml_document doc; diff --git a/tests/test_header_only_2.cpp b/tests/test_header_only_2.cpp index 220c807..e4e876d 100644 --- a/tests/test_header_only_2.cpp +++ b/tests/test_header_only_2.cpp @@ -1,12 +1,14 @@ #define PUGIXML_HEADER_ONLY #define pugi pugih -#include "common.hpp" +#include "test.hpp" // Check header guards #include "../src/pugixml.hpp" #include "../src/pugixml.hpp" +using namespace pugi; + TEST(header_only_2) { xml_document doc; diff --git a/tests/test_memory.cpp b/tests/test_memory.cpp index becb89b..4acda5b 100644 --- a/tests/test_memory.cpp +++ b/tests/test_memory.cpp @@ -1,4 +1,4 @@ -#include "common.hpp" +#include "test.hpp" #include "writer_string.hpp" #include "allocator.hpp" @@ -6,6 +6,8 @@ #include #include +using namespace pugi; + namespace { int page_allocs = 0; diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp index a0af591..dd40bc5 100644 --- a/tests/test_parse.cpp +++ b/tests/test_parse.cpp @@ -1,7 +1,9 @@ -#include "common.hpp" +#include "test.hpp" #include "writer_string.hpp" +using namespace pugi; + TEST(parse_pi_skip) { xml_document doc; diff --git a/tests/test_parse_doctype.cpp b/tests/test_parse_doctype.cpp index e32af8e..861e772 100644 --- a/tests/test_parse_doctype.cpp +++ b/tests/test_parse_doctype.cpp @@ -1,11 +1,13 @@ #define _CRT_SECURE_NO_WARNINGS -#include "common.hpp" +#include "test.hpp" #include #include #include +using namespace pugi; + static xml_parse_result load_concat(xml_document& doc, const char_t* a, const char_t* b = STR(""), const char_t* c = STR("")) { char_t buffer[768]; diff --git a/tests/test_unicode.cpp b/tests/test_unicode.cpp index 1902e36..4cb6114 100644 --- a/tests/test_unicode.cpp +++ b/tests/test_unicode.cpp @@ -1,9 +1,11 @@ #ifndef PUGIXML_NO_STL -#include "common.hpp" +#include "test.hpp" #include +using namespace pugi; + // letters taken from http://www.utf8-chartable.de/ TEST(as_wide_empty) diff --git a/tests/test_write.cpp b/tests/test_write.cpp index 5736273..95cc566 100644 --- a/tests/test_write.cpp +++ b/tests/test_write.cpp @@ -1,4 +1,4 @@ -#include "common.hpp" +#include "test.hpp" #include "writer_string.hpp" @@ -6,6 +6,8 @@ #include #include +using namespace pugi; + TEST_XML(write_simple, "text") { CHECK_NODE_EX(doc, STR("\ntext\n\n"), STR(""), 0); diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp index 24daa4e..19ff25c 100644 --- a/tests/test_xpath.cpp +++ b/tests/test_xpath.cpp @@ -1,6 +1,6 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" #include #include @@ -10,6 +10,8 @@ #include #include +using namespace pugi; + static void load_document_copy(xml_document& doc, const char_t* text) { xml_document source; diff --git a/tests/test_xpath_api.cpp b/tests/test_xpath_api.cpp index f933fb8..7abf7d9 100644 --- a/tests/test_xpath_api.cpp +++ b/tests/test_xpath_api.cpp @@ -2,13 +2,15 @@ #include // because Borland's STL is braindead, we have to include _before_ in order to get memcmp -#include "common.hpp" +#include "test.hpp" #include "helpers.hpp" #include #include +using namespace pugi; + TEST_XML(xpath_api_select_nodes, "") { xpath_node_set ns1 = doc.select_nodes(STR("node/foo")); diff --git a/tests/test_xpath_functions.cpp b/tests/test_xpath_functions.cpp index 604da78..43e334e 100644 --- a/tests/test_xpath_functions.cpp +++ b/tests/test_xpath_functions.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_number_number, "123") { diff --git a/tests/test_xpath_operators.cpp b/tests/test_xpath_operators.cpp index c2281e6..5e1316c 100644 --- a/tests/test_xpath_operators.cpp +++ b/tests/test_xpath_operators.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST(xpath_operators_arithmetic) { diff --git a/tests/test_xpath_parse.cpp b/tests/test_xpath_parse.cpp index 0672c5a..daa12bf 100644 --- a/tests/test_xpath_parse.cpp +++ b/tests/test_xpath_parse.cpp @@ -1,9 +1,11 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" #include +using namespace pugi; + TEST(xpath_literal_parse) { xml_node c; diff --git a/tests/test_xpath_paths.cpp b/tests/test_xpath_paths.cpp index dd97019..54a47ae 100644 --- a/tests/test_xpath_paths.cpp +++ b/tests/test_xpath_paths.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_paths_axes_child, "") { diff --git a/tests/test_xpath_paths_abbrev_w3c.cpp b/tests/test_xpath_paths_abbrev_w3c.cpp index af65752..bd01e65 100644 --- a/tests/test_xpath_paths_abbrev_w3c.cpp +++ b/tests/test_xpath_paths_abbrev_w3c.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_paths_abbrev_w3c_1, "") { diff --git a/tests/test_xpath_paths_w3c.cpp b/tests/test_xpath_paths_w3c.cpp index 2005bc5..1bc2121 100644 --- a/tests/test_xpath_paths_w3c.cpp +++ b/tests/test_xpath_paths_w3c.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_paths_w3c_1, "") { diff --git a/tests/test_xpath_variables.cpp b/tests/test_xpath_variables.cpp index 9349004..d7d7276 100644 --- a/tests/test_xpath_variables.cpp +++ b/tests/test_xpath_variables.cpp @@ -1,9 +1,11 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" #include +using namespace pugi; + TEST(xpath_variables_type_none) { xpath_variable_set set; diff --git a/tests/test_xpath_xalan_1.cpp b/tests/test_xpath_xalan_1.cpp index 7f87c52..0127ddd 100644 --- a/tests/test_xpath_xalan_1.cpp +++ b/tests/test_xpath_xalan_1.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST(xpath_xalan_boolean_1) { diff --git a/tests/test_xpath_xalan_2.cpp b/tests/test_xpath_xalan_2.cpp index 5edae69..4e8c10e 100644 --- a/tests/test_xpath_xalan_2.cpp +++ b/tests/test_xpath_xalan_2.cpp @@ -2,11 +2,13 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" #include #include +using namespace pugi; + TEST_XML(xpath_xalan_string_1, "ENCYCLOPEDIA") { xml_node c; diff --git a/tests/test_xpath_xalan_3.cpp b/tests/test_xpath_xalan_3.cpp index d2df3e5..5228cde 100644 --- a/tests/test_xpath_xalan_3.cpp +++ b/tests/test_xpath_xalan_3.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_xalan_axes_1, "
") { diff --git a/tests/test_xpath_xalan_4.cpp b/tests/test_xpath_xalan_4.cpp index c71eaf7..997ffb4 100644 --- a/tests/test_xpath_xalan_4.cpp +++ b/tests/test_xpath_xalan_4.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_xalan_position_1, "1234") { diff --git a/tests/test_xpath_xalan_5.cpp b/tests/test_xpath_xalan_5.cpp index e6a4fb9..6daa234 100644 --- a/tests/test_xpath_xalan_5.cpp +++ b/tests/test_xpath_xalan_5.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_xalan_select_1, "") { -- cgit v1.2.3