aboutsummaryrefslogtreecommitdiff
path: root/html-test/Main.hs
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-08-14 20:05:37 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-08-22 23:40:27 +0200
commit554db03b637a76a01f2907d3115ef0dc290234c5 (patch)
tree3be67daacda982629edda5148b9bef00ab4fd9cd /html-test/Main.hs
parent20867f75e92931e2131a1badfa6b9606b970eb12 (diff)
Create convenience script for running specific HTML tests.
Diffstat (limited to 'html-test/Main.hs')
-rwxr-xr-xhtml-test/Main.hs38
1 files changed, 38 insertions, 0 deletions
diff --git a/html-test/Main.hs b/html-test/Main.hs
new file mode 100755
index 00000000..8d1b40a8
--- /dev/null
+++ b/html-test/Main.hs
@@ -0,0 +1,38 @@
+{-# LANGUAGE CPP #-}
+
+
+import System.Environment
+import System.FilePath
+
+import Test.Haddock
+import Test.Haddock.Xhtml
+
+
+checkConfig :: CheckConfig Xhtml
+checkConfig = CheckConfig
+ { ccfgRead = \mdl input -> stripIfRequired mdl <$> parseXhtml input
+ , ccfgDump = dumpXhtml
+ , ccfgEqual = (==)
+ }
+
+
+dirConfig :: DirConfig
+dirConfig = defaultDirConfig $ takeDirectory __FILE__
+
+
+main :: IO ()
+main = runAndCheck =<< parseArgs checkConfig dirConfig =<< getArgs
+
+
+stripIfRequired :: String -> Xhtml -> Xhtml
+stripIfRequired mdl =
+ stripLinks' . stripFooter
+ where
+ stripLinks'
+ | mdl `elem` preserveLinksModules = id
+ | otherwise = stripLinks
+
+
+-- | List of modules in which we don't 'stripLinks'
+preserveLinksModules :: [String]
+preserveLinksModules = ["Bug253"]