From 66a1261c68f123b604622e4729d966974198e50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 19 Aug 2021 22:42:36 +0200 Subject: Wait command --- src/Main.hs | 5 +++++ src/Parser.hs | 7 ++++++- src/Test.hs | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Main.hs b/src/Main.hs index 2c16a16..d4134bd 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -190,6 +190,11 @@ runTest tool test = do p <- getProcess net pname expect p regex + Wait -> do + putStr "Waiting..." + hFlush stdout + void $ getLine + exitNetwork net main :: IO () diff --git a/src/Parser.hs b/src/Parser.hs index 97a64fc..d4c5a13 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -110,9 +110,14 @@ testExpect = do pname <- procName return $ Expect pname re +testWait :: TestParser TestStep +testWait = do + wsymbol "wait" + return $ Wait + parseTestDefinition :: TestParser Test parseTestDefinition = label "test definition" $ toplevel $ do - block (\name steps -> return $ Test name steps) header (testSpawn <|> testSend <|> testExpect) + block (\name steps -> return $ Test name steps) header (testSpawn <|> testSend <|> testExpect <|> testWait) where header = do wsymbol "test" lexeme $ TL.toStrict <$> takeWhileP (Just "test name") (/=':') diff --git a/src/Test.hs b/src/Test.hs index f26e67a..8136afb 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -19,6 +19,7 @@ data Test = Test data TestStep = Spawn ProcName NodeName | Send ProcName Text | Expect ProcName Regex + | Wait newtype ProcName = ProcName Text deriving (Eq, Ord) -- cgit v1.2.3