diff options
author | Łukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-08-14 00:34:10 +0200 |
---|---|---|
committer | Łukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-08-22 23:40:27 +0200 |
commit | 5934c411a8ebe0ba1a317f7c95babfbd63106254 (patch) | |
tree | fbc0150d93030e365a67fd79adcb239826b15727 /html-test | |
parent | 869ee23cc7ec1bd2fa9299323b74d71fe6023ef2 (diff) |
Refactor and simplify XHTML helper module of test package.
Diffstat (limited to 'html-test')
-rwxr-xr-x | html-test/run.hs | 17 |
1 files changed, 10 insertions, 7 deletions
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' |