summaryrefslogtreecommitdiff
path: root/src/Parser.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2021-11-18 21:27:22 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2021-11-18 21:27:22 +0100
commite30d876d4839ab70f655adf893e85b1b1312192c (patch)
treee1d6e3a3b9beafa899251541d27a185d891fc6ee /src/Parser.hs
parent19dd575ae33801121b308c082bab70c3bed0a24e (diff)
Show regex partern on expect failure
Diffstat (limited to 'src/Parser.hs')
-rw-r--r--src/Parser.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Parser.hs b/src/Parser.hs
index 1402926..fb1b829 100644
--- a/src/Parser.hs
+++ b/src/Parser.hs
@@ -79,14 +79,14 @@ quotedString = label "string" $ lexeme $ do
symbol "\""
return $ TL.toStrict str
-regex :: TestParser Regex
+regex :: TestParser (Regex, Text)
regex = label "regular expression" $ lexeme $ do
symbol "/"
pat <- takeWhileP Nothing (/='/')
symbol "/"
case compile defaultCompOpt defaultExecOpt ("^" ++ TL.unpack pat ++ "$") of
Left err -> fail err
- Right re -> return re
+ Right re -> return (re, TL.toStrict pat)
testSpawn :: TestParser TestStep
testSpawn = do
@@ -108,10 +108,10 @@ testSend = do
testExpect :: TestParser TestStep
testExpect = do
wsymbol "expect"
- re <- regex
+ (re, pat) <- regex
wsymbol "from"
pname <- procName
- return $ Expect pname re
+ return $ Expect pname re pat
testWait :: TestParser TestStep
testWait = do