blob: e0bb8daf7b438929ac29e9387052f420e9260151 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include "gtest/gtest.h"
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMImplementation.hpp>
#include <xercesc/dom/DOMElement.hpp>
#include <xercesc/dom/DOMText.hpp>
#include <string>
#include "function/base.h"
#include "function/read_file.h"
typedef std::basic_string<XMLCh> XmlString;
class FunctionReadFileTest : public ::testing::Test {
friend InputXSLT::FunctionReadFile;
};
TEST_F(FunctionReadFileTest, constructDocumentTest) {
const InputXSLT::FilesystemContext fsContext("../tests");
const boost::filesystem::path filePath(
fsContext.resolve("./function_read_file.cc")
);
InputXSLT::FunctionReadFile function;
xercesc::DOMDocument* const domDocument = function.constructDocument(
fsContext,
filePath
);
EXPECT_NE(domDocument, nullptr);
EXPECT_EQ(
XmlString(domDocument->getDocumentElement()->getNodeName()),
XmlString(reinterpret_cast<const XMLCh*>(u"content"))
);
EXPECT_EQ(
XmlString(domDocument->getDocumentElement()->getFirstChild()->getNodeName()),
XmlString(reinterpret_cast<const XMLCh*>(u"result"))
);
}
|