Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- processTest :: TestName -> TestProcess -> TestTree
- data TestProcess = TestProcess {}
- proc :: FilePath -> [String] -> CreateProcess
- shell :: String -> CreateProcess
- defaultProcess :: TestProcess
- type ExitCodeCheck = ExitCode -> Either String ()
- type OutputCheck = String -> Either String ()
- equals :: (Show a, Eq a) => a -> a -> Either String ()
- ignored :: a -> Either String ()
- setTimeout :: Integer -> TestTree -> TestTree
Documentation
processTest :: TestName -> TestProcess -> TestTree Source #
Create a TestTree
from a TestProcess
. Here is an example of how to use
the function to create a test.
exampleTest :: TestTree exampleTest = setTimeout (1000000) $ processTest "Simple test" TestProcess { process = (proc "test-executable-simple" []) , input = Nothing , exitCodeCheck = equals ExitSuccess , stdoutCheck = equals "Hello, world!n" , stderrCheck = equals "" }
data TestProcess Source #
TestProcess
is a data type that represents a process to be tested.
TestProcess | |
|
Instances
IsTest (TestProcess, IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)) Source # | |
Defined in Test.Tasty.Process run :: OptionSet -> (TestProcess, IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)) -> (Progress -> IO ()) -> IO Result # testOptions :: Tagged (TestProcess, IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)) [OptionDescription] # |
proc :: FilePath -> [String] -> CreateProcess Source #
Re-export of proc
from System.Process with correct default values.
Construct a CreateProcess
record for passing to createProcess
, representing a command to be passed to the shell.
shell :: String -> CreateProcess Source #
Re-export of shell
from System.Process with correct default values.
Construct a CreateProcess
record for passing to createProcess
, representing a raw command with arguments.
See RawCommand
for precise semantics of the specified FilePath
.
defaultProcess :: TestProcess Source #
The template process configuration.
type ExitCodeCheck = ExitCode -> Either String () Source #
ExitCodeCheck
represents a function that given the ExitCode
of a process,
returns ()
if the exit code is expected, or a reason otherwise.
type OutputCheck = String -> Either String () Source #
OutputCheck
represents a function that given the output of a process,
returns ()
if the output is expected, or a reason otherwise.
equals :: (Show a, Eq a) => a -> a -> Either String () Source #
A helper function for creating equality checks.
>>>
equals "str" "str"
Right ()
>>>
equals ExitSuccess ExitSuccess
Right ()
>>>
equals "expected value" "actual value"
Left "expected : \"expected value\"\nactual : \"actual value\"\n"