mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-20 11:45:53 +00:00
@@ -31,6 +31,7 @@
|
||||
#include <expected>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
using namespace util::async;
|
||||
using namespace ::testing;
|
||||
@@ -46,6 +47,25 @@ struct AnyStrandTests : ::testing::Test {
|
||||
AnyStrand strand{static_cast<MockStrand&>(mockStrand)};
|
||||
};
|
||||
|
||||
TEST_F(AnyStrandTests, Move)
|
||||
{
|
||||
auto mockOp = OperationType<std::any>{};
|
||||
EXPECT_CALL(mockStrand, execute(An<std::function<std::any()>>())).WillOnce(ReturnRef(mockOp));
|
||||
EXPECT_CALL(mockOp, get());
|
||||
|
||||
auto mineNow = std::move(strand);
|
||||
ASSERT_TRUE(mineNow.execute([] { throw 0; }).get());
|
||||
}
|
||||
|
||||
TEST_F(AnyStrandTests, CopyIsRefCounted)
|
||||
{
|
||||
auto mockOp = OperationType<std::any>{};
|
||||
EXPECT_CALL(mockStrand, execute(An<std::function<std::any()>>())).WillOnce(ReturnRef(mockOp));
|
||||
|
||||
auto yoink = strand;
|
||||
ASSERT_TRUE(yoink.execute([] { throw 0; }).get());
|
||||
}
|
||||
|
||||
TEST_F(AnyStrandTests, ExecuteWithoutTokenAndVoid)
|
||||
{
|
||||
auto mockOp = OperationType<std::any>{};
|
||||
|
||||
Reference in New Issue
Block a user