summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--src/Test/Builtins.hs4
2 files changed, 4 insertions, 3 deletions
diff --git a/README.md b/README.md
index 0cf5f21..f189df0 100644
--- a/README.md
+++ b/README.md
@@ -248,10 +248,11 @@ In that case the expect command has to have the `capture` clause with matching n
Results of the captures are then assigned to the newly created variables as strings.
```
-flush [from <proc>]
+flush [from <proc>] [matching <regex>]
```
Flush memory of `<proc>` output, so no following `expect` command will match anything produced up to this point.
+If the `matching` clause is used, discard only output lines matching `<regex>`.
```
guard <expr>
diff --git a/src/Test/Builtins.hs b/src/Test/Builtins.hs
index 6c6c2f0..9babb9e 100644
--- a/src/Test/Builtins.hs
+++ b/src/Test/Builtins.hs
@@ -37,11 +37,11 @@ builtinSend = SomeVarValue (FunctionArguments $ M.fromList atypes) $
builtinFlush :: SomeVarValue
builtinFlush = SomeVarValue (FunctionArguments $ M.fromList atypes) $
- \_ args -> TestBlock [ Flush (getArg args (Just "from")) (getArgMb args Nothing) ]
+ \_ args -> TestBlock [ Flush (getArg args (Just "from")) (getArgMb args (Just "matching")) ]
where
atypes =
[ ( Just "from", SomeArgumentType (ContextDefault @Process) )
- , ( Nothing, SomeArgumentType (OptionalArgument @Regex) )
+ , ( Just "matching", SomeArgumentType (OptionalArgument @Regex) )
]
builtinGuard :: SomeVarValue