module Test where import System.Environment import Test.HUnit import Test.Setup import qualified Test.Connection as Connection import qualified Test.GenericCommands as GenericCommands import qualified Test.StringCommands as StringCommands import qualified Test.ListCommands as ListCommands import qualified Test.SetCommands as SetCommands import qualified Test.ZSetCommands as ZSetCommands import qualified Test.HashCommands as HashCommands import qualified Test.SortCommands as SortCommands import qualified Test.PubSubCommands as PubSubCommands import qualified Test.MultiCommands as MultiCommands import qualified Test.CASCommands as CASCommands import qualified Test.Monad.MultiCommands as M_MultiCommands import qualified Test.Monad.CASCommands as M_CASCommands import qualified Test.Lock as Lock tests = [("connection", TestLabel "Connection" Connection.tests), ("generic", TestLabel "Generic commands" GenericCommands.tests), ("string", TestLabel "String commands" StringCommands.tests), ("list", TestLabel "List commands" ListCommands.tests), ("set", TestLabel "Set commands" SetCommands.tests), ("zset", TestLabel "Sorted set commands" ZSetCommands.tests), ("hash", TestLabel "Hash commands" HashCommands.tests), ("sort", TestLabel "Sort comands" SortCommands.tests), ("pubsub", TestLabel "Pub/Sub commands" PubSubCommands.tests), ("multi", TestLabel "Multi commands" MultiCommands.tests), ("cas", TestLabel "CAS commands" CASCommands.tests), ("multi", TestLabel "Multi commands within monad wrapper" M_MultiCommands.tests), ("cas", TestLabel "CAS commands within monad wrapper" M_CASCommands.tests), ("lock", TestLabel "Lock" Lock.tests)] mkTests Nothing = TestList $ map snd tests mkTests (Just label) = TestList $ map snd $ filter ((== label) . fst) tests main :: IO () main = do args <- getArgs if (length args < 1) then error "Usage: runhaskell Test.hs [label]" else startRedis $ head args let label = if length args < 2 then Nothing else (Just $ args !! 1) runTestTT $ mkTests label shutdownRedis