This commit is contained in:
Joey Hess 2010-11-27 17:31:20 -04:00
parent f8d463b1b7
commit 1f9ce9e9a5

View file

@ -6,7 +6,7 @@ import System.Exit
import System.Directory import System.Directory
type Test = IO Bool type Test = IO Bool
data TestDesc = TestDesc String String Test data TestCase = TestCase String String Test
data Config = Config String Bool data Config = Config String Bool
instance Show Config where instance Show Config where
@ -15,13 +15,13 @@ instance Show Config where
, key ++ " = " ++ show value , key ++ " = " ++ show value
] ]
tests :: [TestDesc] tests :: [TestCase]
tests = [ tests = [
TestDesc "cp -a" "cp_a" $ testCp "-a" TestCase "cp -a" "cp_a" $ testCp "-a"
, TestDesc "cp -p" "cp_p" $ testCp "-p" , TestCase "cp -p" "cp_p" $ testCp "-p"
, TestDesc "cp --reflink=auto" "cp_reflink_auto" $ testCp "--reflink=auto" , TestCase "cp --reflink=auto" "cp_reflink_auto" $ testCp "--reflink=auto"
, TestDesc "uuid" "uuid" $ requireCommand "uuid" "uuid" , TestCase "uuid" "uuid" $ requireCommand "uuid" "uuid"
, TestDesc "xargs -0" "xargs_0" $ requireCommand "xargs -0" "xargs -0 </dev/null" , TestCase "xargs -0" "xargs_0" $ requireCommand "xargs -0" "xargs -0 </dev/null"
] ]
tmpDir :: String tmpDir :: String
@ -70,9 +70,9 @@ writeSysConfig config = writeFile "SysConfig.hs" body
] ]
footer = [] footer = []
runTests :: [TestDesc] -> IO [Config] runTests :: [TestCase] -> IO [Config]
runTests [] = return [] runTests [] = return []
runTests ((TestDesc tname key t):ts) = do runTests ((TestCase tname key t):ts) = do
testStart tname testStart tname
val <- t val <- t
testEnd val testEnd val