mirror of
https://github.com/XRPLF/clio.git
synced 2026-07-25 08:00:18 +00:00
ci: Use Nix-based images for all workflows except pre-commit (#3098)
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "util/async/Outcome.hpp"
|
||||
#include "util/async/context/SyncExecutionContext.hpp"
|
||||
#include "util/async/context/impl/Cancellation.hpp"
|
||||
#include "util/async/impl/Any.hpp"
|
||||
#include "util/async/impl/ErasedOperation.hpp"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
@@ -105,8 +106,8 @@ struct AnyExecutionContextTests : Test {
|
||||
|
||||
TEST_F(AnyExecutionContextTests, Move)
|
||||
{
|
||||
auto mockOp = OperationType<std::any>{};
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<std::any()>>()))
|
||||
auto mockOp = OperationType<impl::Any>{};
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<impl::Any()>>()))
|
||||
.WillOnce(ReturnRef(mockOp));
|
||||
EXPECT_CALL(mockOp, get());
|
||||
|
||||
@@ -116,8 +117,8 @@ TEST_F(AnyExecutionContextTests, Move)
|
||||
|
||||
TEST_F(AnyExecutionContextTests, CopyIsRefCounted)
|
||||
{
|
||||
auto mockOp = OperationType<std::any>{};
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<std::any()>>()))
|
||||
auto mockOp = OperationType<impl::Any>{};
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<impl::Any()>>()))
|
||||
.WillOnce(ReturnRef(mockOp));
|
||||
EXPECT_CALL(mockOp, get());
|
||||
|
||||
@@ -127,8 +128,8 @@ TEST_F(AnyExecutionContextTests, CopyIsRefCounted)
|
||||
|
||||
TEST_F(AnyExecutionContextTests, ExecuteWithoutTokenAndVoid)
|
||||
{
|
||||
auto mockOp = OperationType<std::any>{};
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<std::any()>>()))
|
||||
auto mockOp = OperationType<impl::Any>{};
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<impl::Any()>>()))
|
||||
.WillOnce(ReturnRef(mockOp));
|
||||
EXPECT_CALL(mockOp, get());
|
||||
|
||||
@@ -140,17 +141,17 @@ TEST_F(AnyExecutionContextTests, ExecuteWithoutTokenAndVoid)
|
||||
|
||||
TEST_F(AnyExecutionContextTests, ExecuteWithoutTokenAndVoidThrowsException)
|
||||
{
|
||||
auto mockOp = OperationType<std::any>{};
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<std::any()>>()))
|
||||
.WillOnce([](auto&&) -> OperationType<std::any> const& { throw 0; });
|
||||
auto mockOp = OperationType<impl::Any>{};
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<impl::Any()>>()))
|
||||
.WillOnce([](auto&&) -> OperationType<impl::Any> const& { throw 0; });
|
||||
|
||||
EXPECT_ANY_THROW([[maybe_unused]] auto unused = ctx.execute([] { throw 0; }));
|
||||
}
|
||||
|
||||
TEST_F(AnyExecutionContextTests, ExecuteWithStopTokenAndVoid)
|
||||
{
|
||||
auto mockOp = StoppableOperationType<std::any>{};
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<std::any(AnyStopToken)>>(), _))
|
||||
auto mockOp = StoppableOperationType<impl::Any>{};
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<impl::Any(AnyStopToken)>>(), _))
|
||||
.WillOnce(ReturnRef(mockOp));
|
||||
EXPECT_CALL(mockOp, get());
|
||||
|
||||
@@ -162,17 +163,17 @@ TEST_F(AnyExecutionContextTests, ExecuteWithStopTokenAndVoid)
|
||||
|
||||
TEST_F(AnyExecutionContextTests, ExecuteWithStopTokenAndVoidThrowsException)
|
||||
{
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<std::any(AnyStopToken)>>(), _))
|
||||
.WillOnce([](auto&&, auto) -> StoppableOperationType<std::any> const& { throw 0; });
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<impl::Any(AnyStopToken)>>(), _))
|
||||
.WillOnce([](auto&&, auto) -> StoppableOperationType<impl::Any> const& { throw 0; });
|
||||
|
||||
EXPECT_ANY_THROW([[maybe_unused]] auto unused = ctx.execute([](auto) { throw 0; }));
|
||||
}
|
||||
|
||||
TEST_F(AnyExecutionContextTests, ExecuteWithStopTokenAndReturnValue)
|
||||
{
|
||||
auto mockOp = StoppableOperationType<std::any>{};
|
||||
auto mockOp = StoppableOperationType<impl::Any>{};
|
||||
EXPECT_CALL(mockOp, get()).WillOnce(Return(std::make_any<int>(42)));
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<std::any(AnyStopToken)>>(), _))
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<impl::Any(AnyStopToken)>>(), _))
|
||||
.WillOnce(ReturnRef(mockOp));
|
||||
|
||||
auto op = ctx.execute([](auto) -> int { throw 0; });
|
||||
@@ -183,19 +184,19 @@ TEST_F(AnyExecutionContextTests, ExecuteWithStopTokenAndReturnValue)
|
||||
|
||||
TEST_F(AnyExecutionContextTests, ExecuteWithStopTokenAndReturnValueThrowsException)
|
||||
{
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<std::any(AnyStopToken)>>(), _))
|
||||
.WillOnce([](auto&&, auto) -> StoppableOperationType<std::any> const& { throw 0; });
|
||||
EXPECT_CALL(mockExecutionContext, execute(A<std::function<impl::Any(AnyStopToken)>>(), _))
|
||||
.WillOnce([](auto&&, auto) -> StoppableOperationType<impl::Any> const& { throw 0; });
|
||||
|
||||
EXPECT_ANY_THROW([[maybe_unused]] auto unused = ctx.execute([](auto) -> int { throw 0; }));
|
||||
}
|
||||
|
||||
TEST_F(AnyExecutionContextTests, TimerCancellation)
|
||||
{
|
||||
auto mockScheduledOp = ScheduledOperationType<std::any>{};
|
||||
auto mockScheduledOp = ScheduledOperationType<impl::Any>{};
|
||||
EXPECT_CALL(mockScheduledOp, cancel());
|
||||
EXPECT_CALL(
|
||||
mockExecutionContext,
|
||||
scheduleAfter(std::chrono::milliseconds{12}, A<std::function<std::any(AnyStopToken)>>())
|
||||
scheduleAfter(std::chrono::milliseconds{12}, A<std::function<impl::Any(AnyStopToken)>>())
|
||||
)
|
||||
.WillOnce(ReturnRef(mockScheduledOp));
|
||||
|
||||
@@ -207,13 +208,13 @@ TEST_F(AnyExecutionContextTests, TimerCancellation)
|
||||
|
||||
TEST_F(AnyExecutionContextTests, TimerExecuted)
|
||||
{
|
||||
auto mockScheduledOp = ScheduledOperationType<std::any>{};
|
||||
auto mockScheduledOp = ScheduledOperationType<impl::Any>{};
|
||||
EXPECT_CALL(mockScheduledOp, get()).WillOnce(Return(std::make_any<int>(42)));
|
||||
EXPECT_CALL(
|
||||
mockExecutionContext,
|
||||
scheduleAfter(std::chrono::milliseconds{12}, A<std::function<std::any(AnyStopToken)>>())
|
||||
scheduleAfter(std::chrono::milliseconds{12}, A<std::function<impl::Any(AnyStopToken)>>())
|
||||
)
|
||||
.WillOnce([&mockScheduledOp](auto, auto&&) -> ScheduledOperationType<std::any> const& {
|
||||
.WillOnce([&mockScheduledOp](auto, auto&&) -> ScheduledOperationType<impl::Any> const& {
|
||||
return mockScheduledOp;
|
||||
});
|
||||
|
||||
@@ -225,12 +226,12 @@ TEST_F(AnyExecutionContextTests, TimerExecuted)
|
||||
|
||||
TEST_F(AnyExecutionContextTests, TimerWithBoolHandlerCancellation)
|
||||
{
|
||||
auto mockScheduledOp = ScheduledOperationType<std::any>{};
|
||||
auto mockScheduledOp = ScheduledOperationType<impl::Any>{};
|
||||
EXPECT_CALL(mockScheduledOp, cancel());
|
||||
EXPECT_CALL(
|
||||
mockExecutionContext,
|
||||
scheduleAfter(
|
||||
std::chrono::milliseconds{12}, A<std::function<std::any(AnyStopToken, bool)>>()
|
||||
std::chrono::milliseconds{12}, A<std::function<impl::Any(AnyStopToken, bool)>>()
|
||||
)
|
||||
)
|
||||
.WillOnce(ReturnRef(mockScheduledOp));
|
||||
@@ -243,15 +244,15 @@ TEST_F(AnyExecutionContextTests, TimerWithBoolHandlerCancellation)
|
||||
|
||||
TEST_F(AnyExecutionContextTests, TimerWithBoolHandlerExecuted)
|
||||
{
|
||||
auto mockScheduledOp = ScheduledOperationType<std::any>{};
|
||||
auto mockScheduledOp = ScheduledOperationType<impl::Any>{};
|
||||
EXPECT_CALL(mockScheduledOp, get()).WillOnce(Return(std::make_any<int>(42)));
|
||||
EXPECT_CALL(
|
||||
mockExecutionContext,
|
||||
scheduleAfter(
|
||||
std::chrono::milliseconds{12}, A<std::function<std::any(AnyStopToken, bool)>>()
|
||||
std::chrono::milliseconds{12}, A<std::function<impl::Any(AnyStopToken, bool)>>()
|
||||
)
|
||||
)
|
||||
.WillOnce([&mockScheduledOp](auto, auto&&) -> ScheduledOperationType<std::any> const& {
|
||||
.WillOnce([&mockScheduledOp](auto, auto&&) -> ScheduledOperationType<impl::Any> const& {
|
||||
return mockScheduledOp;
|
||||
});
|
||||
|
||||
@@ -264,13 +265,13 @@ TEST_F(AnyExecutionContextTests, TimerWithBoolHandlerExecuted)
|
||||
|
||||
TEST_F(AnyExecutionContextTests, RepeatingOperation)
|
||||
{
|
||||
auto mockRepeatingOp = RepeatingOperationType<std::any>{};
|
||||
auto mockRepeatingOp = RepeatingOperationType<impl::Any>{};
|
||||
EXPECT_CALL(mockRepeatingOp, wait());
|
||||
EXPECT_CALL(
|
||||
mockExecutionContext,
|
||||
executeRepeatedly(std::chrono::milliseconds{1}, A<std::function<std::any()>>())
|
||||
executeRepeatedly(std::chrono::milliseconds{1}, A<std::function<impl::Any()>>())
|
||||
)
|
||||
.WillOnce([&mockRepeatingOp] -> RepeatingOperationType<std::any> const& {
|
||||
.WillOnce([&mockRepeatingOp] -> RepeatingOperationType<impl::Any> const& {
|
||||
return mockRepeatingOp;
|
||||
});
|
||||
|
||||
@@ -281,11 +282,11 @@ TEST_F(AnyExecutionContextTests, RepeatingOperation)
|
||||
|
||||
TEST_F(AnyExecutionContextTests, StrandExecuteWithVoid)
|
||||
{
|
||||
auto mockOp = OperationType<std::any>{};
|
||||
auto mockOp = OperationType<impl::Any>{};
|
||||
auto mockStrand = StrandType{};
|
||||
EXPECT_CALL(mockOp, get());
|
||||
EXPECT_CALL(mockExecutionContext, makeStrand()).WillOnce(ReturnRef(mockStrand));
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<std::any()>>())).WillOnce(ReturnRef(mockOp));
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<impl::Any()>>())).WillOnce(ReturnRef(mockOp));
|
||||
|
||||
auto strand = ctx.makeStrand();
|
||||
static_assert(std::is_same_v<decltype(strand), AnyStrand>);
|
||||
@@ -300,8 +301,8 @@ TEST_F(AnyExecutionContextTests, StrandExecuteWithVoidThrowsException)
|
||||
{
|
||||
auto mockStrand = StrandType{};
|
||||
EXPECT_CALL(mockExecutionContext, makeStrand()).WillOnce(ReturnRef(mockStrand));
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<std::any()>>()))
|
||||
.WillOnce([](auto&&) -> OperationType<std::any> const& { throw 0; });
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<impl::Any()>>()))
|
||||
.WillOnce([](auto&&) -> OperationType<impl::Any> const& { throw 0; });
|
||||
|
||||
auto strand = ctx.makeStrand();
|
||||
static_assert(std::is_same_v<decltype(strand), AnyStrand>);
|
||||
@@ -311,11 +312,11 @@ TEST_F(AnyExecutionContextTests, StrandExecuteWithVoidThrowsException)
|
||||
|
||||
TEST_F(AnyExecutionContextTests, StrandExecuteWithReturnValue)
|
||||
{
|
||||
auto mockOp = OperationType<std::any>{};
|
||||
auto mockOp = OperationType<impl::Any>{};
|
||||
auto mockStrand = StrandType{};
|
||||
EXPECT_CALL(mockOp, get()).WillOnce(Return(std::make_any<int>(42)));
|
||||
EXPECT_CALL(mockExecutionContext, makeStrand()).WillOnce(ReturnRef(mockStrand));
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<std::any()>>())).WillOnce(ReturnRef(mockOp));
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<impl::Any()>>())).WillOnce(ReturnRef(mockOp));
|
||||
|
||||
auto strand = ctx.makeStrand();
|
||||
static_assert(std::is_same_v<decltype(strand), AnyStrand>);
|
||||
@@ -330,8 +331,8 @@ TEST_F(AnyExecutionContextTests, StrandExecuteWithReturnValueThrowsException)
|
||||
{
|
||||
auto mockStrand = StrandType{};
|
||||
EXPECT_CALL(mockExecutionContext, makeStrand()).WillOnce(ReturnRef(mockStrand));
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<std::any()>>()))
|
||||
.WillOnce([](auto&&) -> OperationType<std::any> const& { throw 0; });
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<impl::Any()>>()))
|
||||
.WillOnce([](auto&&) -> OperationType<impl::Any> const& { throw 0; });
|
||||
|
||||
auto strand = ctx.makeStrand();
|
||||
static_assert(std::is_same_v<decltype(strand), AnyStrand>);
|
||||
@@ -341,11 +342,11 @@ TEST_F(AnyExecutionContextTests, StrandExecuteWithReturnValueThrowsException)
|
||||
|
||||
TEST_F(AnyExecutionContextTests, StrandExecuteWithStopTokenAndVoid)
|
||||
{
|
||||
auto mockOp = StoppableOperationType<std::any>{};
|
||||
auto mockOp = StoppableOperationType<impl::Any>{};
|
||||
auto mockStrand = StrandType{};
|
||||
EXPECT_CALL(mockOp, get());
|
||||
EXPECT_CALL(mockExecutionContext, makeStrand()).WillOnce(ReturnRef(mockStrand));
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<std::any(AnyStopToken)>>(), _))
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<impl::Any(AnyStopToken)>>(), _))
|
||||
.WillOnce(ReturnRef(mockOp));
|
||||
|
||||
auto strand = ctx.makeStrand();
|
||||
@@ -361,8 +362,8 @@ TEST_F(AnyExecutionContextTests, StrandExecuteWithStopTokenAndVoidThrowsExceptio
|
||||
{
|
||||
auto mockStrand = StrandType{};
|
||||
EXPECT_CALL(mockExecutionContext, makeStrand()).WillOnce(ReturnRef(mockStrand));
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<std::any(AnyStopToken)>>(), _))
|
||||
.WillOnce([](auto&&, auto) -> StoppableOperationType<std::any> const& { throw 0; });
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<impl::Any(AnyStopToken)>>(), _))
|
||||
.WillOnce([](auto&&, auto) -> StoppableOperationType<impl::Any> const& { throw 0; });
|
||||
|
||||
auto strand = ctx.makeStrand();
|
||||
static_assert(std::is_same_v<decltype(strand), AnyStrand>);
|
||||
@@ -372,11 +373,11 @@ TEST_F(AnyExecutionContextTests, StrandExecuteWithStopTokenAndVoidThrowsExceptio
|
||||
|
||||
TEST_F(AnyExecutionContextTests, StrandExecuteWithStopTokenAndReturnValue)
|
||||
{
|
||||
auto mockOp = StoppableOperationType<std::any>{};
|
||||
auto mockOp = StoppableOperationType<impl::Any>{};
|
||||
auto mockStrand = StrandType{};
|
||||
EXPECT_CALL(mockOp, get()).WillOnce(Return(std::make_any<int>(42)));
|
||||
EXPECT_CALL(mockExecutionContext, makeStrand()).WillOnce(ReturnRef(mockStrand));
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<std::any(AnyStopToken)>>(), _))
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<impl::Any(AnyStopToken)>>(), _))
|
||||
.WillOnce(ReturnRef(mockOp));
|
||||
|
||||
auto strand = ctx.makeStrand();
|
||||
@@ -392,8 +393,8 @@ TEST_F(AnyExecutionContextTests, StrandExecuteWithStopTokenAndReturnValueThrowsE
|
||||
{
|
||||
auto mockStrand = StrandType{};
|
||||
EXPECT_CALL(mockExecutionContext, makeStrand()).WillOnce(ReturnRef(mockStrand));
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<std::any(AnyStopToken)>>(), _))
|
||||
.WillOnce([](auto&&, auto) -> StoppableOperationType<std::any> const& { throw 0; });
|
||||
EXPECT_CALL(mockStrand, execute(A<std::function<impl::Any(AnyStopToken)>>(), _))
|
||||
.WillOnce([](auto&&, auto) -> StoppableOperationType<impl::Any> const& { throw 0; });
|
||||
|
||||
auto strand = ctx.makeStrand();
|
||||
static_assert(std::is_same_v<decltype(strand), AnyStrand>);
|
||||
|
||||
Reference in New Issue
Block a user