summaryrefslogtreecommitdiff
path: root/src/Test
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-08-30 22:09:14 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2025-09-01 20:44:22 +0200
commit27bf4a78b7203ed77790c92134213c3398214daa (patch)
tree5e17a92e4d4704ede7823595f42fb45ef686afbf /src/Test
parentfc40dfc41e8b3fbbe830846499ccce122930b235 (diff)
Add "ignore" commandHEADmaster
Changelog: Added `ignore` builtin command
Diffstat (limited to 'src/Test')
-rw-r--r--src/Test/Builtins.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Test/Builtins.hs b/src/Test/Builtins.hs
index 6dba707..244ff57 100644
--- a/src/Test/Builtins.hs
+++ b/src/Test/Builtins.hs
@@ -8,7 +8,7 @@ import Data.Proxy
import Data.Scientific
import Data.Text (Text)
-import Process (Process)
+import Process
import Script.Expr
import Test
@@ -16,6 +16,7 @@ builtins :: GlobalDefs
builtins = M.fromList
[ fq "send" builtinSend
, fq "flush" builtinFlush
+ , fq "ignore" builtinIgnore
, fq "guard" builtinGuard
, fq "multiply_timeout" builtinMultiplyTimeout
, fq "wait" builtinWait
@@ -52,6 +53,15 @@ builtinFlush = SomeVarValue $ VarValue [] (FunctionArguments $ M.fromList atypes
, ( Just "matching", SomeArgumentType (OptionalArgument @Regex) )
]
+builtinIgnore :: SomeVarValue
+builtinIgnore = SomeVarValue $ VarValue [] (FunctionArguments $ M.fromList atypes) $
+ \_ args -> TestBlockStep EmptyTestBlock $ CreateObject (Proxy @IgnoreProcessOutput) ( getArg args (Just "from"), getArgMb args (Just "matching") )
+ where
+ atypes =
+ [ ( Just "from", SomeArgumentType (ContextDefault @Process) )
+ , ( Just "matching", SomeArgumentType (OptionalArgument @Regex) )
+ ]
+
builtinGuard :: SomeVarValue
builtinGuard = SomeVarValue $ VarValue [] (FunctionArguments $ M.singleton Nothing (SomeArgumentType (RequiredArgument @Bool))) $
\sline args -> TestBlockStep EmptyTestBlock $ Guard sline (getArgVars args Nothing) (getArg args Nothing)