aboutsummaryrefslogtreecommitdiff
path: root/html-test
diff options
context:
space:
mode:
authorMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-04-11 18:47:41 +0100
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-04-11 18:47:41 +0100
commit1a4b54cca2239881a998af9ce472a2dc519f3ca4 (patch)
treee779ff17ee3cefc71bb6890276986c1660963346 /html-test
parentaf3b1444239027170f5e99a6dd67c1e2c6c44432 (diff)
Ignore version string during HTML tests.
Diffstat (limited to 'html-test')
-rwxr-xr-xhtml-test/run.lhs14
1 files changed, 13 insertions, 1 deletions
diff --git a/html-test/run.lhs b/html-test/run.lhs
index e4c83da6..153ab32c 100755
--- a/html-test/run.lhs
+++ b/html-test/run.lhs
@@ -134,9 +134,21 @@ check modules strict = do
else do
putStrLn $ "Pass: " ++ mod ++ " (no .ref file)"
+-- | A rather nasty way to drop the Haddock version string from the
+-- end of the generated HTML files so that we don't have to change
+-- every single test every time we change versions. We rely on the the
+-- last paragraph of the document to be the version. We end up with
+-- malformed HTML but we don't care as we never look at it ourselves.
+dropVersion :: String -> String
+dropVersion = reverse . dropTillP . reverse
+ where
+ dropTillP [] = []
+ dropTillP ('p':'<':xs) = xs
+ dropTillP (_:xs) = dropTillP xs
haddockEq :: String -> String -> Bool
-haddockEq file1 file2 = stripLinks file1 == stripLinks file2
+haddockEq file1 file2 =
+ stripLinks (dropVersion file1) == stripLinks (dropVersion file2)
stripLinks :: String -> String
stripLinks str =