summaryrefslogtreecommitdiff
path: root/src/Run.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2024-11-30 19:31:49 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2024-12-02 20:48:22 +0100
commit57516242357cba015cc5e99e28d7f5e87dc5d7e8 (patch)
treedb29e6b02310650e421f573d3cd3b5add69fd820 /src/Run.hs
parent1670b628cc7accea1c7ecd9359a7dccb6bd50a45 (diff)
Trace regex variables in expect using new type
Diffstat (limited to 'src/Run.hs')
-rw-r--r--src/Run.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Run.hs b/src/Run.hs
index 54fdba6..f6eba39 100644
--- a/src/Run.hs
+++ b/src/Run.hs
@@ -273,9 +273,8 @@ exprFailed desc sline pname exprVars = do
]
throwError Failed
-expect :: SourceLine -> Process -> Expr Regex -> [TypedVarName Text] -> TestRun () -> TestRun ()
-expect sline p expr tvars inner = do
- re <- eval expr
+expect :: SourceLine -> Process -> Traced Regex -> [TypedVarName Text] -> TestRun () -> TestRun ()
+expect sline p (Traced trace re) tvars inner = do
timeout <- asks $ optTimeout . teOptions . fst
delay <- liftIO $ registerDelay $ ceiling $ 1000000 * timeout
mbmatch <- atomicallyTest $ (Nothing <$ (check =<< readTVar delay)) <|> do
@@ -302,7 +301,7 @@ expect sline p expr tvars inner = do
outProc OutputMatch p line
local (fmap $ \s -> s { tsVars = zip vars (map someConstValue capture) ++ tsVars s }) inner
- Nothing -> exprFailed (T.pack "expect") sline (Just $ procName p) =<< gatherVars expr
+ Nothing -> exprFailed (T.pack "expect") sline (Just $ procName p) trace
flush :: Process -> Maybe Regex -> TestRun ()
flush p mbre = do