From 224366e2c668784952ab613c7640d7017ce60990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Mon, 23 Oct 2023 21:05:55 +0200 Subject: Flush command Changelog: Add 'flush' command --- src/Parser/Statement.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/Parser/Statement.hs') diff --git a/src/Parser/Statement.hs b/src/Parser/Statement.hs index e58779b..732f417 100644 --- a/src/Parser/Statement.hs +++ b/src/Parser/Statement.hs @@ -106,6 +106,13 @@ instance ParamType a => ParamType [a] where paramDefault _ = return [] paramFromSomeExpr _ se@(SomeExpr e) = cast e <|> ((:[]) <$> paramFromSomeExpr @a Proxy se) +instance ParamType a => ParamType (Maybe a) where + type ParamRep (Maybe a) = Maybe (ParamRep a) + parseParam _ = Just <$> parseParam @a Proxy + showParamType _ = showParamType @a Proxy + paramDefault _ = return Nothing + paramFromSomeExpr _ se = Just <$> paramFromSomeExpr @a Proxy se + instance (ParamType a, ParamType b) => ParamType (Either a b) where type ParamRep (Either a b) = Either (ParamRep a) (ParamRep b) parseParam _ = try (Left <$> parseParam @a Proxy) <|> (Right <$> parseParam @b Proxy) @@ -289,6 +296,11 @@ testExpect = command "expect" $ Expect <*> param "capture" <*> innerBlock +testFlush :: TestParser [TestStep] +testFlush = command "flush" $ Flush + <$> paramOrContext "from" + <*> param "" + testGuard :: TestParser [TestStep] testGuard = command "guard" $ Guard <$> cmdLine @@ -344,6 +356,7 @@ testStep = choice , testSpawn , testSend , testExpect + , testFlush , testGuard , testDisconnectNode , testDisconnectNodes -- cgit v1.2.3