From 87c16512eb16c1877f9d9e060d29579a4a9df382 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Thu, 9 Feb 2023 13:38:39 +0100 Subject: [PATCH] [statemachine] use lambda syntax --- tests/codex/utils/testasyncstatemachine.nim | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tests/codex/utils/testasyncstatemachine.nim b/tests/codex/utils/testasyncstatemachine.nim index b3727a32..06eead9f 100644 --- a/tests/codex/utils/testasyncstatemachine.nim +++ b/tests/codex/utils/testasyncstatemachine.nim @@ -1,3 +1,4 @@ +import std/sugar import pkg/asynctest import pkg/questionable import pkg/chronos @@ -54,20 +55,10 @@ suite "async state machines": test "state2 moves to state3 on event": machine.start(state2) - - proc moveToNextStateEvent(state: State): ?State = - state.onMoveToNextStateEvent() - - machine.schedule(moveToNextStateEvent) - + machine.schedule(state => state.onMoveToNextStateEvent()) check eventually runs == [0, 1, 1] test "state transition will cancel the running state": machine.start(state2) - - proc moveToNextStateEvent(state: State): ?State = - state.onMoveToNextStateEvent() - - machine.schedule(moveToNextStateEvent) - + machine.schedule(state => state.onMoveToNextStateEvent()) check eventually cancellations == [0, 1, 0]