summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2021-08-19 22:42:36 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2021-08-19 22:42:36 +0200
commit66a1261c68f123b604622e4729d966974198e50e (patch)
treeb8e01250f645e98177e9e800cd62014c19a1cf20 /src
parent1c5cc6281d1320b3ad3ee586368c0c1dacce0cbe (diff)
Wait command
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs5
-rw-r--r--src/Parser.hs7
-rw-r--r--src/Test.hs1
3 files changed, 12 insertions, 1 deletions
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)