-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Runs system tests of applications. -- -- System Test is a Haskell application which allows you to specify and -- run system tests of applications. Tests are defined in JSON files, -- whereby each test has a name, command, and expected output. @package system-test @version 0.1.2 module Test.SystemTest.Test -- | Represents a single test, with a name, a command, and an expected -- result. data Test Test :: String -> String -> String -> Test -- | The name of the Test. [name] :: Test -> String -- | The command the to be run for the Test. [command] :: Test -> String -- | The expected result of the output of the command. [expectedOutput] :: Test -> String -- | Shows the contents of the values of the Test. -- | Converts JSON into Test. -- | Represents the results of a single test, including if it passed or -- failed, and the actual output. type TestResults = (Bool, String) -- | Runs the command of a Test and checks to see if the output of the -- command is the same as the expected output of the Test. -- -- If the result of running the command is equal to the expected result, -- then True will be returned. However, if the expected and actual -- results are not equal, then False will be returned. -- -- The actual output of the test is also returned, so that it can be -- printed out in the case where the test fails. -- --
--   >>> runTest (Test "Hello" "echo 'Hello, World!'" "Hello, World!")
--   (True,"Hello, World!")
--   
-- --
--   >>> runTest (Test "Hello" "echo 'Goodbye, World!'" "Hello, World!")
--   (False,"Goodbye, World!")
--   
runTest :: Test -> IO TestResults -- | Returns a String showing the results of the Test. Includes the name of -- the Test and if it passed or failed. -- --
--   >>> let test = Test "HelloTest" "echo 'Hello, World!'" "Hello, World!"
--   
--   >>> result <- runTest test
--   
--   >>> showResults test result
--   "HelloTest: Passed"
--   
-- --
--   >>> let test = Test "GoodbyeTest" "echo 'Goodbye, World!'" "Hello, World!"
--   
--   >>> result <- runTest test
--   
--   >>> showResults test result
--   "GoodbyeTest: Failed\n  Expected: Hello, World!\n  Actual:   Goodbye, World!"
--   
showResults :: Test -> TestResults -> String instance GHC.Show.Show Test.SystemTest.Test.Test instance Data.Aeson.Types.Class.FromJSON Test.SystemTest.Test.Test module Test.SystemTest.Main -- | Gets the files to be tested and runs the tests they contain. progMain :: IO () -- | Runs the tests contained in the given file, and prints out their -- results. testFile :: String -> IO () -- | Prints out the results of the given test with a color based on the -- results. Passing tests are printed in green, and failing tests are -- printed in red. printResults :: Test -> TestResults -> IO () -- | Handles the ending of the program. Prints out the number of tests that -- failed, if any. Also gives an exit failure if any tests failed. endProgram :: Int -> Int -> IO ()