mirror of
https://github.com/XRPLF/clio.git
synced 2026-04-29 15:37:53 +00:00
32 lines
592 B
C++
32 lines
592 B
C++
#include "util/MockAssert.hpp"
|
|
|
|
#include "util/Assert.hpp"
|
|
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
namespace common::util {
|
|
|
|
WithMockAssert::WithMockAssert()
|
|
{
|
|
::util::impl::OnAssert::setAction([](std::string_view m) { WithMockAssert::throwOnAssert(m); });
|
|
}
|
|
|
|
WithMockAssert::~WithMockAssert()
|
|
{
|
|
::util::impl::OnAssert::resetAction();
|
|
}
|
|
|
|
void
|
|
WithMockAssert::throwOnAssert(std::string_view m)
|
|
{
|
|
throw MockAssertException{.message = std::string{m}};
|
|
}
|
|
|
|
WithMockAssertNoThrow::~WithMockAssertNoThrow()
|
|
{
|
|
::util::impl::OnAssert::resetAction();
|
|
}
|
|
|
|
} // namespace common::util
|