diff options
author | David Waern <david.waern@gmail.com> | 2011-11-24 15:00:24 +0100 |
---|---|---|
committer | David Waern <david.waern@gmail.com> | 2011-11-24 15:00:24 +0100 |
commit | 2927dd725ee11acb04133ddefed5038847f6737f (patch) | |
tree | 785076b77387b95aa8a3651923c58429eb0689d7 /tests/html-tests | |
parent | 27c3e36448ab7092e0f52be1ce245c7f58a6ebca (diff) |
Fix a bug in test runner and get rid of regex-compat dependency.
Diffstat (limited to 'tests/html-tests')
-rw-r--r-- | tests/html-tests/runtests.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/html-tests/runtests.hs b/tests/html-tests/runtests.hs index 48ea5214..35de8c0b 100644 --- a/tests/html-tests/runtests.hs +++ b/tests/html-tests/runtests.hs @@ -16,7 +16,6 @@ import System.Exit import System.FilePath import System.Process import Text.Printf -import Text.Regex packageRoot = "." @@ -58,7 +57,7 @@ test = do -- TODO: maybe do something more clever here using haddock.cabal ghcPath <- fmap init $ rawSystemStdout normal haddockPath ["--print-ghc-path"] - (_, conf) <- configure normal (Just ghcPath) Nothing emptyProgramConfiguration + (_, conf) <- configure normal (Just ghcPath) Nothing defaultProgramConfiguration pkgIndex <- getInstalledPackages normal [GlobalPackageDB] conf let safeHead xs = case xs of x : _ -> Just x; [] -> Nothing let mkDep pkgName = @@ -118,9 +117,14 @@ check modules strict = do haddockEq file1 file2 = stripLinks file1 == stripLinks file2 - -stripLinks f = subRegex (mkRegexWithOpts "<A HREF=[^>]*>" False False) f "<A HREF=\"\">" - +stripLinks str = + let prefix = "<a href=\"" in + case stripPrefix prefix str of + Just str' -> prefix ++ stripLinks (dropWhile (/= '"') str') + Nothing -> + case str of + [] -> [] + x : xs -> x : stripLinks xs programOnPath p = do result <- findProgramLocation silent p |