aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--haddock.cabal4
-rw-r--r--hypsrc-test/Main.hs30
2 files changed, 32 insertions, 2 deletions
diff --git a/haddock.cabal b/haddock.cabal
index 019f235e..fde2ad4e 100644
--- a/haddock.cabal
+++ b/haddock.cabal
@@ -132,9 +132,9 @@ test-suite html-test
test-suite hypsrc-test
type: exitcode-stdio-1.0
default-language: Haskell2010
- main-is: run.hs
+ main-is: Main.hs
hs-source-dirs: hypsrc-test
- build-depends: base, directory, process, filepath, Cabal
+ build-depends: base, filepath, haddock-test
ghc-options: -Wall -fwarn-tabs
test-suite latex-test
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