Repository : ssh://darcs.haskell.org//srv/darcs/haddock

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/2927dd725ee11acb04133ddefed5038847f6737f

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

commit 2927dd725ee11acb04133ddefed5038847f6737f
Author: David Waern <[email protected]>
Date:   Thu Nov 24 15:00:24 2011 +0100

    Fix a bug in test runner and get rid of regex-compat dependency.

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

 haddock.cabal                |    2 +-
 tests/html-tests/runtests.hs |   14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/haddock.cabal b/haddock.cabal
index 221d724..1180cad 100644
--- a/haddock.cabal
+++ b/haddock.cabal
@@ -210,7 +210,7 @@ test-suite html-tests
   default-language: Haskell2010
   main-is:          runtests.hs
   hs-source-dirs:   tests/html-tests
-  build-depends:    base, directory, process, filepath, Cabal, regex-compat
+  build-depends:    base, directory, process, filepath, Cabal
 
 source-repository head
   type:     git
diff --git a/tests/html-tests/runtests.hs b/tests/html-tests/runtests.hs
index 48ea521..35de8c0 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



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to