stuff-from-scratch/test/web/TestXmlParser.cpp
2022-12-01 10:52:48 +00:00

30 lines
694 B
C++

#include <iostream>
#include <fstream>
#include "XmlParser.h"
#include "XmlWriter.h"
#include "File.h"
#include "TestFramework.h"
#include "TestUtils.h"
TEST_CASE(TestXmlParser, "web")
{
XmlParser parser;
std::ifstream xml_file;
xml_file.open(TestUtils::getTestDataDir() / "test.xml", std::ifstream::in);
while(xml_file.good())
{
std::string line;
std::getline(xml_file, line);
parser.ProcessLine(line);
}
xml_file.close();
XmlWriter writer;
auto content = writer.ToString(parser.GetDocument().get());
auto outFile = std::make_unique<File>(TestUtils::getTestOutputDir() / "test_out.xml");
outFile->writeText(content);
}