From bb7d45db2b79f310ab8c2601b47399d5ac69e085 Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Tue, 18 Aug 2015 20:43:52 +0200 Subject: Make it possible to specify ignored files for test output. --- haddock-test/src/Test/Haddock.hs | 4 +++- haddock-test/src/Test/Haddock/Config.hs | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'haddock-test/src') diff --git a/haddock-test/src/Test/Haddock.hs b/haddock-test/src/Test/Haddock.hs index f31ec53f..581b0d10 100644 --- a/haddock-test/src/Test/Haddock.hs +++ b/haddock-test/src/Test/Haddock.hs @@ -38,7 +38,7 @@ checkFiles :: Config c -> IO () checkFiles cfg@(Config { .. }) = do putStrLn "Testing output files..." - files <- getDirectoryContents (cfgOutDir cfg) + files <- ignore <$> getDirectoryContents (cfgOutDir cfg) failed <- liftM catMaybes . forM files $ \file -> do putStr $ "Checking \"" ++ file ++ "\"... " @@ -56,6 +56,8 @@ checkFiles cfg@(Config { .. }) = do else do maybeDiff cfg failed exitFailure + where + ignore = filter (not . dcfgCheckIgnore cfgDirConfig) maybeDiff :: Config c -> [FilePath] -> IO () diff --git a/haddock-test/src/Test/Haddock/Config.hs b/haddock-test/src/Test/Haddock/Config.hs index 1b89e276..256e9a93 100644 --- a/haddock-test/src/Test/Haddock/Config.hs +++ b/haddock-test/src/Test/Haddock/Config.hs @@ -53,6 +53,7 @@ data DirConfig = DirConfig , dcfgRefDir :: FilePath , dcfgOutDir :: FilePath , dcfgResDir :: FilePath + , dcfgCheckIgnore :: FilePath -> Bool } @@ -62,6 +63,7 @@ defaultDirConfig baseDir = DirConfig , dcfgRefDir = baseDir "ref" , dcfgOutDir = baseDir "out" , dcfgResDir = rootDir "resources" + , dcfgCheckIgnore = const False } where rootDir = baseDir ".." -- cgit v1.2.3