From c2d2c481da18310053396bb0d2a9d070335eb865 Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Fri, 14 Aug 2015 20:53:34 +0200 Subject: Adapt `hypsrc-test` module to work with new testing framework. --- hypsrc-test/Main.hs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 hypsrc-test/Main.hs (limited to 'hypsrc-test/Main.hs') 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 -- cgit v1.2.3