tweak
This commit is contained in:
parent
161823d6ea
commit
0996403377
1 changed files with 7 additions and 8 deletions
15
configure.hs
15
configure.hs
|
@ -9,6 +9,12 @@ type Test = IO Bool
|
|||
data TestDesc = TestDesc String String Test
|
||||
data Config = Config String Bool
|
||||
|
||||
instance Show Config where
|
||||
show (Config key value) = unlines $ [
|
||||
key ++ " :: Bool"
|
||||
, key ++ " = " ++ show value
|
||||
]
|
||||
|
||||
tests :: [TestDesc]
|
||||
tests = [
|
||||
TestDesc "cp -a" "cp_a" $ testCp "-a"
|
||||
|
@ -44,7 +50,7 @@ testEnd r = putStrLn $ " " ++ (show r)
|
|||
|
||||
writeSysConfig :: [Config] -> IO ()
|
||||
writeSysConfig config = do
|
||||
writeFile "SysConfig.hs" $ unlines $ header ++ vars config ++ footer
|
||||
writeFile "SysConfig.hs" $ unlines $ header ++ map show config ++ footer
|
||||
where
|
||||
header = [
|
||||
"{- Automatically generated by configure. -}"
|
||||
|
@ -52,13 +58,6 @@ writeSysConfig config = do
|
|||
, ""
|
||||
]
|
||||
footer = []
|
||||
vars [] = []
|
||||
vars (c:cs) = showvar c ++ vars cs
|
||||
showvar (Config name val) = [
|
||||
name ++ " :: Bool"
|
||||
, name ++ " = " ++ show val
|
||||
, ""
|
||||
]
|
||||
|
||||
runTests :: [TestDesc] -> IO [Config]
|
||||
runTests [] = return []
|
||||
|
|
Loading…
Reference in a new issue