Use buffers_to_string in tests

fix #782
This commit is contained in:
Vinnie Falco committed 2018-04-24 10:55:39 -07:00
1 parent 5abac8b380
commit 14392d7f52
21 files changed
+164 -281

No files matched your search

+2 -14
View File
@@ -10,6 +10,7 @@
// Test that header file is self-contained.
#include <boost/beast/http/dynamic_body.hpp>
#include <boost/beast/core/buffers_to_string.hpp>
#include <boost/beast/core/ostream.hpp>
#include <boost/beast/http/fields.hpp>
#include <boost/beast/http/parser.hpp>
@@ -37,19 +38,6 @@ public:
return ss.str();
}
template<class ConstBufferSequence>
static
std::string
to_string(ConstBufferSequence const& bs)
{
std::string s;
s.reserve(boost::asio::buffer_size(bs));
for(auto b : beast::detail::buffers_range(bs))
s.append(reinterpret_cast<char const*>(b.data()),
b.size());
return s;
}
void
run() override
{
@@ -64,7 +52,7 @@ public:
multi_buffer b;
read(ts, b, p);
auto const& m = p.get();
BEAST_EXPECT(to_string(m.body().data()) == "xyz");
BEAST_EXPECT(buffers_to_string(m.body().data()) == "xyz");
BEAST_EXPECT(to_string(m) == s);
}
};