[commit: haddock] 2.17.3.1-spanfix, alexbiehl-patch-1, ghc-8.0, ghc-8.0-facebook, ghc-head, ghc-head1, haddock-quick, headdock-library-1.4.5, ie_avails, issue-303, issue-475, master, pr-filter-maps, pr/cabal-desc, travis, v2.17, v2.17.3, v2.18, wip-located-module-as, wip/D2418, wip/T11080-open-data-kinds, wip/T11430, wip/T12105, wip/T12105-2, wip/T12942, wip/T13163, wip/T14529, wip/T3384, wip/embelleshed-rdr, wip/new-tree-one-param, wip/rae, wip/remove-frames, wip/remove-frames1, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13, wip/ttg6-unrevert-2017-11-22: Adapt `hypsrc-test` module to work with new testing framework. (c2d2c48)

git at git.haskell.org git at git.haskell.org
Tue Nov 28 11:38:05 UTC 2017


Repository : ssh://git@git.haskell.org/haddock

On branches: 2.17.3.1-spanfix,alexbiehl-patch-1,ghc-8.0,ghc-8.0-facebook,ghc-head,ghc-head1,haddock-quick,headdock-library-1.4.5,ie_avails,issue-303,issue-475,master,pr-filter-maps,pr/cabal-desc,travis,v2.17,v2.17.3,v2.18,wip-located-module-as,wip/D2418,wip/T11080-open-data-kinds,wip/T11430,wip/T12105,wip/T12105-2,wip/T12942,wip/T13163,wip/T14529,wip/T3384,wip/embelleshed-rdr,wip/new-tree-one-param,wip/rae,wip/remove-frames,wip/remove-frames1,wip/revert-ttg-2017-11-20,wip/ttg-2017-10-13,wip/ttg-2017-10-31,wip/ttg-2017-11-06,wip/ttg2-2017-11-10,wip/ttg3-2017-11-12,wip/ttg4-constraints-2017-11-13,wip/ttg6-unrevert-2017-11-22
Link       : http://git.haskell.org/haddock.git/commitdiff/c2d2c481da18310053396bb0d2a9d070335eb865

>---------------------------------------------------------------

commit c2d2c481da18310053396bb0d2a9d070335eb865
Author: Ɓukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date:   Fri Aug 14 20:53:34 2015 +0200

    Adapt `hypsrc-test` module to work with new testing framework.


>---------------------------------------------------------------

c2d2c481da18310053396bb0d2a9d070335eb865
 haddock.cabal                      |  4 ++--
 {html-test => hypsrc-test}/Main.hs | 22 +++++++---------------
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/haddock.cabal b/haddock.cabal
index 019f235..fde2ad4 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/html-test/Main.hs b/hypsrc-test/Main.hs
old mode 100755
new mode 100644
similarity index 51%
copy from html-test/Main.hs
copy to hypsrc-test/Main.hs
index 8d1b40a..b1b48ca
--- a/html-test/Main.hs
+++ b/hypsrc-test/Main.hs
@@ -1,6 +1,8 @@
 {-# LANGUAGE CPP #-}
 
 
+import Data.List
+
 import System.Environment
 import System.FilePath
 
@@ -10,10 +12,14 @@ import Test.Haddock.Xhtml
 
 checkConfig :: CheckConfig Xhtml
 checkConfig = CheckConfig
-    { ccfgRead = \mdl input -> stripIfRequired mdl <$> parseXhtml input
+    { 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
@@ -22,17 +28,3 @@ 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"]



More information about the ghc-commits mailing list