diff options
author | Łukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-08-04 14:21:22 +0200 |
---|---|---|
committer | Łukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-08-22 23:40:26 +0200 |
commit | 17be133c363d161cff0a0e21968784afd2f7058a (patch) | |
tree | 075bc7489bd718451f7c0a5bafbd689ca7e1cf3d /html-test | |
parent | da76b1b4ea86ad8b27f722ad803be40b512c9e00 (diff) |
Refactor test runner and create stub functions.
Diffstat (limited to 'html-test')
-rwxr-xr-x | html-test/run.hs | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/html-test/run.hs b/html-test/run.hs index 3a421be7..a9fe8bb7 100755 --- a/html-test/run.hs +++ b/html-test/run.hs @@ -48,15 +48,25 @@ data Config = Config main :: IO () main = do - cfg <- loadConfig =<< getArgs + cfg <- uncurry loadConfig =<< checkOpt =<< getArgs putStrLn $ show cfg + runHaddock cfg + checkOutput cfg -loadConfig :: [String] -> IO Config -loadConfig args = do +checkOutput :: Config -> IO () +checkOutput _ = return () -- TODO. + + +runHaddock :: Config -> IO () +runHaddock _ = return () -- TODO. + + +checkOpt :: [String] -> IO ([Flag], [String]) +checkOpt args = do let (flags, files, errors) = getOpt Permute options args - when (not $ null errors) $ do + unless (null errors) $ do hPutStr stderr $ concat errors exitFailure @@ -64,6 +74,11 @@ loadConfig args = do hPutStrLn stderr $ usageInfo "" options exitSuccess + return (flags, files) + + +loadConfig :: [Flag] -> [String] -> IO Config +loadConfig flags files = do env <- Just . (:) ("haddock_datadir", resDir) <$> getEnvironment cfgHaddockPath <- pure $ flip fromMaybe (flagsHaddockPath flags) $ |