From 554db03b637a76a01f2907d3115ef0dc290234c5 Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Fri, 14 Aug 2015 20:05:37 +0200 Subject: Create convenience script for running specific HTML tests. --- html-test/Main.hs | 38 ++++++++++++++++++++++++++++++++++++++ html-test/run | 5 +++++ html-test/run.hs | 38 -------------------------------------- 3 files changed, 43 insertions(+), 38 deletions(-) create mode 100755 html-test/Main.hs create mode 100755 html-test/run delete mode 100755 html-test/run.hs (limited to 'html-test') 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"] diff --git a/html-test/run b/html-test/run new file mode 100755 index 00000000..5e17ad0f --- /dev/null +++ b/html-test/run @@ -0,0 +1,5 @@ +#!/bin/bash + +export HADDOCK_PATH=$(which haddock) +LIB_PATH="$(dirname "$BASH_SOURCE")/../haddock-test/src/" +runhaskell -i:"$LIB_PATH" "Main.hs" $@ diff --git a/html-test/run.hs b/html-test/run.hs deleted file mode 100755 index 8d1b40a8..00000000 --- a/html-test/run.hs +++ /dev/null @@ -1,38 +0,0 @@ -{-# 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"] -- cgit v1.2.3