aboutsummaryrefslogtreecommitdiff
path: root/hypsrc-test/Main.hs
diff options
context:
space:
mode:
authorAlec Theriault <alec.theriault@gmail.com>2019-01-31 12:43:39 -0800
committerAlec Theriault <alec.theriault@gmail.com>2019-02-02 18:06:12 -0800
commitbf07847e45356024e10d1a325f015ac53544ea85 (patch)
treedcf55b0db9ff72eeeac16add251df55805c3ab5e /hypsrc-test/Main.hs
parentbc683d664657dc2ed228b57a05344e1b0cfd8fa6 (diff)
Fix some Hyperlinker test suite fallout
* Amend `ParserSpec` to match new Hyperlinker API - pass in compiler info - strip out null tokens * Make `hypsrc-test` pass reliably - strip out `local-*` ids - strip out `line-*` ids from the `ClangCppBug` test - re-accept output
Diffstat (limited to 'hypsrc-test/Main.hs')
-rw-r--r--hypsrc-test/Main.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/hypsrc-test/Main.hs b/hypsrc-test/Main.hs
index d3ab79a8..1963753d 100644
--- a/hypsrc-test/Main.hs
+++ b/hypsrc-test/Main.hs
@@ -15,14 +15,23 @@ import Test.Haddock.Xhtml
checkConfig :: CheckConfig Xml
checkConfig = CheckConfig
{ ccfgRead = parseXml
- , ccfgClean = \_ -> strip
+ , ccfgClean = strip
, ccfgDump = dumpXml
, ccfgEqual = (==) `on` dumpXml
}
where
- strip = stripAnchors' . stripLinks' . stripFooter
+ -- The whole point of the ClangCppBug is to demonstrate a situation where
+ -- line numbers may vary (and test that links still work). Consequently, we
+ -- strip out line numbers for this test case.
+ strip f | takeBaseName f == "ClangCppBug"
+ = stripAnchors' . stripLinks' . stripIds' . stripIds'' . stripFooter
+ | otherwise
+ = stripAnchors' . stripLinks' . stripIds' . stripFooter
+
stripLinks' = stripLinksWhen $ \href -> "#local-" `isPrefixOf` href
stripAnchors' = stripAnchorsWhen $ \name -> "local-" `isPrefixOf` name
+ stripIds' = stripIdsWhen $ \name -> "local-" `isPrefixOf` name
+ stripIds'' = stripIdsWhen $ \name -> "line-" `isPrefixOf` name
dirConfig :: DirConfig