-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simple Perl inspired testing -- -- Test.Simple provides simple, Perl inspired primitives for easy -- testing. It outputs test results in TAP format. @package test-simple @version 0.1.8 -- | Test.Simple is yet another testing library for Haskell. It has testing -- primitives familiar to recovering Perl programmers :). -- -- Having MonadPlus instance allows to cut tests early e.g using -- guard function. -- -- Being monad transformer it includes integration with -- QuickCheck by declaring Testable instance on -- TestSimpleT Gen a. -- -- Test.Simple also has the ability to run in pure context (see -- runTestSimple function). -- -- Here is an example suitable for cabal test-suite integration. Note -- that TemplateHaskell usage is optional and is needed for test failure -- locations only. -- --
--   {-# LANGUAGE TemplateHaskell #-}
--   
--   import Test.Simple
--   import Control.Monad
--   
--   main :: IO ()
--   main = testSimpleMain $ do
--             plan 7
--             ok True
--             is 1 1
--             isnt "a" "b"
--             like "abcd" "bc"
--             unlike "a" "b"
--             diag "Successful so far, failures follow ..."
--             $loc >> ok False -- location will be recorded
--             is "a" "b" >>= guard
--             diag "I am not being called" -- not reached because of the guard: MonadPlus FTW!
--    
--   
module Test.Simple -- | Test.Simple is implemented as monad transformer. data TestSimpleT m a -- | Is used in like, unlike tests. class Likeable a b -- | Returns True if a is like b isLike :: Likeable a b => a -> b -> Bool -- | Runs TestSimpleT transformer in IO. Outputs results in -- TAP format. Exits with error on test failure. testSimpleMain :: MonadIO m => TestSimpleT m a -> m () -- | Runs TestSimpleT transformer. Returns whether the tests where -- successful and resulting output. runTestSimple :: Monad m => TestSimpleT m a -> m (Bool, [String]) -- | Run some Testable monad through QuickCheck function. -- Exit with failure on error. qcTestSimpleWith :: (Testable (m a), Monad m) => (m a -> IO Result) -> m a -> IO () -- | Run some Testable monad through QuickCheck. Exit with -- failure on error. Equivalent to qcTestSimpleWith -- quickCheckResult qcTestSimpleMain :: (Testable (m a), Monad m) => m a -> IO () -- | Sets expected number of tests. Running more or less tests is -- considered failure. Note, that plans are composable, e.g: -- --
--   (plan 1 >> ok True) >> (plan 1 >> ok True)
--   
-- -- will expect 2 tests. plan :: Monad m => Int -> TestSimpleT m () -- | Is Bool ok? ok :: Monad m => Bool -> TestSimpleT m Bool -- | Are values different? isnt :: (Eq a, Show a, Monad m) => a -> a -> TestSimpleT m Bool -- | Are values equal? is :: (Eq a, Show a, Monad m) => a -> a -> TestSimpleT m Bool -- | Is a like b? like :: (Show a, Show b, Likeable a b, Monad m) => a -> b -> TestSimpleT m Bool -- | Is a unlike b? unlike :: (Show a, Show b, Likeable a b, Monad m) => a -> b -> TestSimpleT m Bool -- | Is Either right? isRight :: (Monad m, Show a) => Either a b -> TestSimpleT m Bool -- | Records current location to output in case of failures. Necessary -- caveat: failing later without updating location produces the last -- location recorded. loc :: Q Exp -- | Outputs diagnostics message. diag :: Monad m => String -> TestSimpleT m () -- | Generates and logs (through diag) arbitrary value. Also outputs -- current location. diagen :: Show a => String -> Gen a -> TestSimpleT Gen a instance GHC.Base.Monad m => GHC.Base.Applicative (Test.Simple.TestSimpleT m) instance GHC.Base.Monad m => GHC.Base.Alternative (Test.Simple.TestSimpleT m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Test.Simple.TestSimpleT m) instance GHC.Base.Monad m => Control.Monad.State.Class.MonadState Test.Simple.TSState (Test.Simple.TestSimpleT m) instance GHC.Base.Monad m => GHC.Base.MonadPlus (Test.Simple.TestSimpleT m) instance GHC.Base.Monad m => GHC.Base.Monad (Test.Simple.TestSimpleT m) instance Control.Monad.Trans.Class.MonadTrans Test.Simple.TestSimpleT instance GHC.Base.Functor m => GHC.Base.Functor (Test.Simple.TestSimpleT m) instance GHC.Classes.Eq a => Test.Simple.Likeable [a] [a] instance Test.QuickCheck.Property.Testable (Test.Simple.TestSimpleT Test.QuickCheck.Gen.Gen a) instance Test.QuickCheck.Property.Testable (Test.Simple.TestSimpleT (Test.QuickCheck.Monadic.PropertyM GHC.Types.IO) a)