From 5934c411a8ebe0ba1a317f7c95babfbd63106254 Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Fri, 14 Aug 2015 00:34:10 +0200 Subject: Refactor and simplify XHTML helper module of test package. --- html-test/run.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'html-test') diff --git a/html-test/run.hs b/html-test/run.hs index 2758bf56..ab007f57 100755 --- a/html-test/run.hs +++ b/html-test/run.hs @@ -7,13 +7,11 @@ import System.FilePath import Test.Haddock import Test.Haddock.Xhtml -import qualified Text.XML.Light as Xml - -checkConfig :: CheckConfig Xml.Element +checkConfig :: CheckConfig Xhtml checkConfig = CheckConfig - { ccfgRead = \_ input -> strip <$> Xml.parseXMLDoc input - , ccfgDump = Xml.ppElement + { ccfgRead = \mdl input -> stripIfRequired mdl <$> parseXhtml input + , ccfgDump = dumpXhtml , ccfgEqual = (==) } @@ -26,8 +24,13 @@ main :: IO () main = runAndCheck =<< parseArgs checkConfig dirConfig =<< getArgs --- *** OLD TEST RUNNER UTILITY FUNCTIONS *** --- These are considered bad and should be replaced as soon as possible. +stripIfRequired :: String -> Xhtml -> Xhtml +stripIfRequired mdl = + stripLinks' . stripFooter + where + stripLinks' + | mdl `elem` preserveLinksModules = id + | otherwise = stripFooter -- | List of modules in which we don't 'stripLinks' -- cgit v1.2.3