forked from boostorg/beast
Boost prep
This commit is contained in:
+23
-19
@@ -4,13 +4,16 @@
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
// Test that header file is self-contained.
|
||||
#include <beast/http/span_body.hpp>
|
||||
#include <boost/beast/http/span_body.hpp>
|
||||
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/unit_test/suite.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/unit_test/suite.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
namespace http {
|
||||
|
||||
@@ -24,23 +27,23 @@ struct span_body_test
|
||||
using B = span_body<char const>;
|
||||
request<B> req;
|
||||
|
||||
BEAST_EXPECT(req.body.size() == 0);
|
||||
BEAST_EXPECT(B::size(req.body) == 0);
|
||||
BOOST_BEAST_EXPECT(req.body.size() == 0);
|
||||
BOOST_BEAST_EXPECT(B::size(req.body) == 0);
|
||||
|
||||
req.body = B::value_type("xyz", 3);
|
||||
BEAST_EXPECT(req.body.size() == 3);
|
||||
BEAST_EXPECT(B::size(req.body) == 3);
|
||||
BOOST_BEAST_EXPECT(req.body.size() == 3);
|
||||
BOOST_BEAST_EXPECT(B::size(req.body) == 3);
|
||||
|
||||
B::reader r{req};
|
||||
error_code ec;
|
||||
r.init(ec);
|
||||
BEAST_EXPECTS(! ec, ec.message());
|
||||
BOOST_BEAST_EXPECTS(! ec, ec.message());
|
||||
auto const buf = r.get(ec);
|
||||
BEAST_EXPECTS(! ec, ec.message());
|
||||
if(! BEAST_EXPECT(buf != boost::none))
|
||||
BOOST_BEAST_EXPECTS(! ec, ec.message());
|
||||
if(! BOOST_BEAST_EXPECT(buf != boost::none))
|
||||
return;
|
||||
BEAST_EXPECT(boost::asio::buffer_size(buf->first) == 3);
|
||||
BEAST_EXPECT(! buf->second);
|
||||
BOOST_BEAST_EXPECT(boost::asio::buffer_size(buf->first) == 3);
|
||||
BOOST_BEAST_EXPECT(! buf->second);
|
||||
}
|
||||
{
|
||||
char buf[5];
|
||||
@@ -50,16 +53,16 @@ struct span_body_test
|
||||
B::writer w{req};
|
||||
error_code ec;
|
||||
w.init(boost::none, ec);
|
||||
BEAST_EXPECTS(! ec, ec.message());
|
||||
BOOST_BEAST_EXPECTS(! ec, ec.message());
|
||||
w.put(boost::asio::const_buffers_1{
|
||||
"123", 3}, ec);
|
||||
BEAST_EXPECTS(! ec, ec.message());
|
||||
BEAST_EXPECT(buf[0] == '1');
|
||||
BEAST_EXPECT(buf[1] == '2');
|
||||
BEAST_EXPECT(buf[2] == '3');
|
||||
BOOST_BEAST_EXPECTS(! ec, ec.message());
|
||||
BOOST_BEAST_EXPECT(buf[0] == '1');
|
||||
BOOST_BEAST_EXPECT(buf[1] == '2');
|
||||
BOOST_BEAST_EXPECT(buf[2] == '3');
|
||||
w.put(boost::asio::const_buffers_1{
|
||||
"456", 3}, ec);
|
||||
BEAST_EXPECTS(ec == error::buffer_overflow, ec.message());
|
||||
BOOST_BEAST_EXPECTS(ec == error::buffer_overflow, ec.message());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +73,8 @@ struct span_body_test
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(span_body,http,beast);
|
||||
BOOST_BEAST_DEFINE_TESTSUITE(span_body,http,beast);
|
||||
|
||||
} // http
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
Reference in New Issue
Block a user