summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-01-20 20:37:14 -0800
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-01-24 08:20:42 -0800
commit650a4c6cca98e3d1c973d86b91797e85f4861e6d (patch)
tree2a57a021a00cfe1d461a5ba1c23244a64d383455 /tests
parent3181a305edc9159c71036ff0070f1c3153ec3f1d (diff)
Use string::append in implementations of xml_writer
The current code is not optimal; since users actually read samples/tests change them to use faster (and shorter!) code.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_write.cpp2
-rw-r--r--tests/writer_string.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_write.cpp b/tests/test_write.cpp
index ca230c3..da83745 100644
--- a/tests/test_write.cpp
+++ b/tests/test_write.cpp
@@ -171,7 +171,7 @@ struct test_writer: xml_writer
virtual void write(const void* data, size_t size)
{
CHECK(size % sizeof(pugi::char_t) == 0);
- contents += std::basic_string<pugi::char_t>(static_cast<const pugi::char_t*>(data), static_cast<const pugi::char_t*>(data) + size / sizeof(pugi::char_t));
+ contents.append(static_cast<const pugi::char_t*>(data), size / sizeof(pugi::char_t));
}
};
diff --git a/tests/writer_string.cpp b/tests/writer_string.cpp
index a09678b..661c792 100644
--- a/tests/writer_string.cpp
+++ b/tests/writer_string.cpp
@@ -15,7 +15,7 @@ static bool test_narrow(const std::string& result, const char* expected, size_t
void xml_writer_string::write(const void* data, size_t size)
{
- contents += std::string(static_cast<const char*>(data), size);
+ contents.append(static_cast<const char*>(data), size);
}
std::string xml_writer_string::as_narrow() const