mirror of
https://github.com/boostorg/beast.git
synced 2026-01-27 09:42:18 +01:00
fix #404 Parsing and serialization interfaces have been fine tuned and unified. For parsing these stream operations are defined: * read * read_header * read_some * async_read * async_read_header * async_read_some For serialization these stream operations are defined: * write * write_header * write_some * async_write * async_write_header * async_write_some
54 lines
1.0 KiB
C++
54 lines
1.0 KiB
C++
//
|
|
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
|
//
|
|
// 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)
|
|
//
|
|
|
|
// Test that header file is self-contained.
|
|
#include <beast/core/bind_handler.hpp>
|
|
|
|
#include <beast/core/detail/type_traits.hpp>
|
|
#include <beast/unit_test/suite.hpp>
|
|
#include <functional>
|
|
|
|
namespace beast {
|
|
|
|
class bind_handler_test : public unit_test::suite
|
|
{
|
|
public:
|
|
struct handler
|
|
{
|
|
void
|
|
operator()() const;
|
|
};
|
|
|
|
#if 0
|
|
// This function should fail to compile
|
|
void
|
|
failStdBind()
|
|
{
|
|
std::bind(bind_handler(handler{}));
|
|
}
|
|
#endif
|
|
|
|
void
|
|
callback(int v)
|
|
{
|
|
BEAST_EXPECT(v == 42);
|
|
}
|
|
|
|
void run()
|
|
{
|
|
auto f = bind_handler(std::bind(
|
|
&bind_handler_test::callback, this,
|
|
std::placeholders::_1), 42);
|
|
f();
|
|
pass();
|
|
}
|
|
};
|
|
|
|
BEAST_DEFINE_TESTSUITE(bind_handler,core,beast);
|
|
|
|
} // beast
|