summaryrefslogtreecommitdiffhomepage
path: root/test-webserver.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-04-12 22:20:33 +0200
committerRoland Reichwein <mail@reichwein.it>2020-04-12 22:20:33 +0200
commit4732dc63657f4c6fc342f7674f7dc7c666b293dc (patch)
treeda91a5dbbd62982284435d252dd89ac963952ee9 /test-webserver.cpp
parent3f778eecc705990598f1033e6245522f42e2fcb5 (diff)
webbox (WIP)
Diffstat (limited to 'test-webserver.cpp')
-rw-r--r--test-webserver.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/test-webserver.cpp b/test-webserver.cpp
index baf8b3f..1b2c043 100644
--- a/test-webserver.cpp
+++ b/test-webserver.cpp
@@ -1,6 +1,41 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/xml_parser.hpp>
+
+#include <sstream>
+#include <string>
+
+using namespace std::string_literals;
+namespace pt = boost::property_tree;
+
+TEST(property_tree, put)
+{
+ pt::ptree p;
+
+ pt::ptree entry;
+ entry.put_value("name1.txt");
+ entry.put("<xmlattr>.type", "file1");
+
+ p.push_back(pt::ptree::value_type("listentry", entry));
+
+ entry.put_value("name2.txt");
+ entry.put("<xmlattr>.type", "file2");
+
+ p.push_back(pt::ptree::value_type("listentry", entry));
+
+ pt::ptree list;
+ list.push_back(pt::ptree::value_type("list", p));
+
+ std::stringstream ss;
+
+ pt::xml_parser::write_xml(ss, list /*, pt::xml_parser::xml_writer_make_settings<std::string>(' ', 1)*/);
+
+ EXPECT_EQ(ss.str(), "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<list><listentry type=\"file1\">name1.txt</listentry><listentry type=\"file2\">name2.txt</listentry></list>");
+}
+
+
int main(int argc, char* argv[]) {
::testing::InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS();