diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2023-10-23 21:05:55 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-10-23 21:05:55 +0200 |
commit | 224366e2c668784952ab613c7640d7017ce60990 (patch) | |
tree | ebbad4d9d53119c6f1b0f74ada973efa8ac06a86 /src/Parser/Statement.hs | |
parent | ff5c3f5a91e249694f3b76109027cf9d0c717a7c (diff) |
Flush command
Changelog: Add 'flush' command
Diffstat (limited to 'src/Parser/Statement.hs')
-rw-r--r-- | src/Parser/Statement.hs | 13 |
1 files changed, 13 insertions, 0 deletions
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 |