From 27bf4a78b7203ed77790c92134213c3398214daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 30 Aug 2025 22:09:14 +0200 Subject: Add "ignore" command Changelog: Added `ignore` builtin command --- src/Test/Builtins.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/Test') 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) -- cgit v1.2.3