diff options
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Main.hs b/src/Main.hs index 5e1e7b2..efab611 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -296,6 +296,13 @@ expect (SourceLine sline) p re vars = do outLine OutputMatchFail (Just $ procName p) $ T.pack "expect failed on " `T.append` sline throwError () +testStepGuard :: SourceLine -> Expr Bool -> TestRun () +testStepGuard (SourceLine sline) expr = do + x <- eval expr + when (not x) $ do + outLine OutputMatchFail Nothing $ T.pack "guard failed on " `T.append` sline + throwError () + allM :: Monad m => [a] -> (a -> m Bool) -> m Bool allM (x:xs) p = p x >>= \case True -> allM xs p; False -> return False allM [] _ = return True @@ -340,6 +347,9 @@ runTest out opts test = do regex <- eval expr expect line p regex captures + Guard line expr -> do + testStepGuard line expr + Wait -> do outPrompt $ T.pack "Waiting..." void $ liftIO $ getLine |