aboutsummaryrefslogtreecommitdiff
path: root/hypsrc-test
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-08-14 20:53:34 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-08-22 23:40:27 +0200
commitc2d2c481da18310053396bb0d2a9d070335eb865 (patch)
tree968c315ac3b948138b9a95fa5aedaddfe5319cbb /hypsrc-test
parent1cb714e35337a6b17d7fc37f086914f43f7f2da3 (diff)
Adapt `hypsrc-test` module to work with new testing framework.
Diffstat (limited to 'hypsrc-test')
-rw-r--r--hypsrc-test/Main.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/hypsrc-test/Main.hs b/hypsrc-test/Main.hs
new file mode 100644
index 00000000..b1b48ca4
--- /dev/null
+++ b/hypsrc-test/Main.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE CPP #-}
+
+
+import Data.List
+
+import System.Environment
+import System.FilePath
+
+import Test.Haddock
+import Test.Haddock.Xhtml
+
+
+checkConfig :: CheckConfig Xhtml
+checkConfig = CheckConfig
+ { ccfgRead = \_ input -> strip <$> parseXhtml input
+ , ccfgDump = dumpXhtml
+ , ccfgEqual = (==)
+ }
+ where
+ strip = stripAnchors' . stripLinks' . stripFooter
+ stripLinks' = stripLinksWhen $ \href -> "#local-" `isPrefixOf` href
+ stripAnchors' = stripAnchorsWhen $ \name -> "local-" `isPrefixOf` name
+
+
+dirConfig :: DirConfig
+dirConfig = defaultDirConfig $ takeDirectory __FILE__
+
+
+main :: IO ()
+main = runAndCheck =<< parseArgs checkConfig dirConfig =<< getArgs