forked from boostorg/beast
Add core errors and conditions
This commit is contained in:
@@ -9,3 +9,47 @@
|
||||
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/error.hpp>
|
||||
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
|
||||
class error_test : public unit_test::suite
|
||||
{
|
||||
public:
|
||||
// no condition
|
||||
void check(error e)
|
||||
{
|
||||
auto const ec = make_error_code(e);
|
||||
ec.category().name();
|
||||
BEAST_EXPECT(! ec.message().empty());
|
||||
}
|
||||
|
||||
void check(condition c, error e)
|
||||
{
|
||||
{
|
||||
auto const ec = make_error_code(e);
|
||||
BEAST_EXPECT(ec.category().name() != nullptr);
|
||||
BEAST_EXPECT(! ec.message().empty());
|
||||
BEAST_EXPECT(ec == c);
|
||||
}
|
||||
{
|
||||
auto ec = make_error_condition(c);
|
||||
BEAST_EXPECT(ec.category().name() != nullptr);
|
||||
BEAST_EXPECT(! ec.message().empty());
|
||||
BEAST_EXPECT(ec == c);
|
||||
}
|
||||
}
|
||||
|
||||
void run() override
|
||||
{
|
||||
check(condition::timeout, error::timeout);
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(beast,websocket,error);
|
||||
|
||||
} // beast
|
||||
} // boost
|
||||
|
||||
Reference in New Issue
Block a user