0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-25 20:14:10 +08:00

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.
This commit is contained in:
Arseny Kapoulkine 2017-06-22 20:41:08 -07:00
parent 4b371e10ee
commit 5867aff943
29 changed files with 82 additions and 36 deletions

View File

@ -1,8 +0,0 @@
#ifndef HEADER_TEST_COMMON_HPP
#define HEADER_TEST_COMMON_HPP
#include "test.hpp"
using namespace pugi;
#endif

View File

@ -1,7 +1,7 @@
#ifndef HEADER_TEST_HELPERS_HPP
#define HEADER_TEST_HELPERS_HPP
#include "common.hpp"
#include "test.hpp"
#include <utility>

View File

@ -1,5 +1,7 @@
#ifdef PUGIXML_COMPACT
#include "common.hpp"
#include "test.hpp"
using namespace pugi;
static void overflow_hash_table(xml_document& doc)
{

View File

@ -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)
{

View File

@ -5,7 +5,7 @@
#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"
#include "test.hpp"
#include "writer_string.hpp"
@ -26,6 +26,8 @@
# include <unistd.h> // 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");

View File

@ -1,4 +1,4 @@
#include "common.hpp"
#include "test.hpp"
#include <limits>
#include <string>
@ -7,6 +7,8 @@
#include <string.h>
#include <limits.h>
using namespace pugi;
TEST_XML(dom_attr_assign, "<node/>")
{
xml_node node = doc.child(STR("node"));

View File

@ -1,9 +1,11 @@
#include "common.hpp"
#include "test.hpp"
#include "helpers.hpp"
#include <limits.h>
using namespace pugi;
TEST_XML_FLAGS(dom_text_empty, "<node><a>foo</a><b><![CDATA[bar]]></b><c><?pi value?></c><d/></node>", parse_default | parse_pi)
{
xml_node node = doc.child(STR("node"));

View File

@ -2,7 +2,7 @@
#define _SCL_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_DEPRECATE
#include "common.hpp"
#include "test.hpp"
#include <string.h>
#include <stdio.h>
@ -15,6 +15,8 @@
#include "helpers.hpp"
using namespace pugi;
#ifdef PUGIXML_NO_STL
template <typename I> static I move_iter(I base, int n)
{

View File

@ -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;

View File

@ -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;

View File

@ -1,4 +1,4 @@
#include "common.hpp"
#include "test.hpp"
#include "writer_string.hpp"
#include "allocator.hpp"
@ -6,6 +6,8 @@
#include <string>
#include <vector>
using namespace pugi;
namespace
{
int page_allocs = 0;

View File

@ -1,7 +1,9 @@
#include "common.hpp"
#include "test.hpp"
#include "writer_string.hpp"
using namespace pugi;
TEST(parse_pi_skip)
{
xml_document doc;

View File

@ -1,11 +1,13 @@
#define _CRT_SECURE_NO_WARNINGS
#include "common.hpp"
#include "test.hpp"
#include <string.h>
#include <wchar.h>
#include <string>
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];

View File

@ -1,9 +1,11 @@
#ifndef PUGIXML_NO_STL
#include "common.hpp"
#include "test.hpp"
#include <string>
using namespace pugi;
// letters taken from http://www.utf8-chartable.de/
TEST(as_wide_empty)

View File

@ -1,4 +1,4 @@
#include "common.hpp"
#include "test.hpp"
#include "writer_string.hpp"
@ -6,6 +6,8 @@
#include <sstream>
#include <stdexcept>
using namespace pugi;
TEST_XML(write_simple, "<node attr='1'><child>text</child></node>")
{
CHECK_NODE_EX(doc, STR("<node attr=\"1\">\n<child>text</child>\n</node>\n"), STR(""), 0);

View File

@ -1,6 +1,6 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
#include <string.h>
#include <wchar.h>
@ -10,6 +10,8 @@
#include <algorithm>
#include <limits>
using namespace pugi;
static void load_document_copy(xml_document& doc, const char_t* text)
{
xml_document source;

View File

@ -2,13 +2,15 @@
#include <string.h> // because Borland's STL is braindead, we have to include <string.h> _before_ <string> in order to get memcmp
#include "common.hpp"
#include "test.hpp"
#include "helpers.hpp"
#include <string>
#include <vector>
using namespace pugi;
TEST_XML(xpath_api_select_nodes, "<node><head/><foo/><foo/><tail/></node>")
{
xpath_node_set ns1 = doc.select_nodes(STR("node/foo"));

View File

@ -1,6 +1,8 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
using namespace pugi;
TEST_XML(xpath_number_number, "<node>123</node>")
{

View File

@ -1,6 +1,8 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
using namespace pugi;
TEST(xpath_operators_arithmetic)
{

View File

@ -1,9 +1,11 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
#include <string>
using namespace pugi;
TEST(xpath_literal_parse)
{
xml_node c;

View File

@ -1,6 +1,8 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
using namespace pugi;
TEST_XML(xpath_paths_axes_child, "<node attr='value'><child attr='value'><subchild/></child><another/><last/></node>")
{

View File

@ -1,6 +1,8 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
using namespace pugi;
TEST_XML(xpath_paths_abbrev_w3c_1, "<node><para/><foo/><para/></node>")
{

View File

@ -1,6 +1,8 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
using namespace pugi;
TEST_XML(xpath_paths_w3c_1, "<node><para/><foo/><para/></node>")
{

View File

@ -1,9 +1,11 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
#include <string>
using namespace pugi;
TEST(xpath_variables_type_none)
{
xpath_variable_set set;

View File

@ -1,6 +1,8 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
using namespace pugi;
TEST(xpath_xalan_boolean_1)
{

View File

@ -2,11 +2,13 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
#include <string>
#include <algorithm>
using namespace pugi;
TEST_XML(xpath_xalan_string_1, "<doc a='test'>ENCYCLOPEDIA</doc>")
{
xml_node c;

View File

@ -1,6 +1,8 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
using namespace pugi;
TEST_XML(xpath_xalan_axes_1, "<far-north><north-north-west1/><north-north-west2/><north><near-north><far-west/><west/><near-west/><center center-attr-1='c1' center-attr-2='c2' center-attr-3='c3'><near-south-west/><near-south><south><far-south/></south></near-south><near-south-east/></center><near-east/><east/><far-east/></near-north></north><north-north-east1/><north-north-east2/></far-north>")
{

View File

@ -1,6 +1,8 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
using namespace pugi;
TEST_XML(xpath_xalan_position_1, "<doc><a>1</a><a>2</a><a>3</a><a>4</a></doc>")
{

View File

@ -1,6 +1,8 @@
#ifndef PUGIXML_NO_XPATH
#include "common.hpp"
#include "test.hpp"
using namespace pugi;
TEST_XML(xpath_xalan_select_1, "<doc><a><b attr='test'/></a><c><d><e/></d></c></doc>")
{