aboutsummaryrefslogtreecommitdiff
path: root/html-test/run.lhs
diff options
context:
space:
mode:
authorSimon Hengel <sol@typeful.net>2013-09-03 19:14:08 +0200
committerAustin Seipp <austin@well-typed.com>2014-01-12 14:48:35 -0600
commit27876dc77ff259e27a71ea6f30662a668adfd134 (patch)
treeb8f1784867200ae07a136078dfa14b50271a4476 /html-test/run.lhs
parent64eb7dbc465ffea7f7e76f9d4c3a334380cce8ac (diff)
Don't append newline to parseString input
We also check that we have parsed everything with endOfInput.
Diffstat (limited to 'html-test/run.lhs')
-rwxr-xr-xhtml-test/run.lhs21
1 files changed, 17 insertions, 4 deletions
diff --git a/html-test/run.lhs b/html-test/run.lhs
index 1ce3e797..e4c83da6 100755
--- a/html-test/run.lhs
+++ b/html-test/run.lhs
@@ -15,12 +15,11 @@ import Distribution.Simple.Program
import Distribution.Simple.Utils
import Distribution.Verbosity
import System.IO
-import System.Cmd
import System.Directory
import System.Environment
import System.Exit
import System.FilePath
-import System.Process (ProcessHandle, runProcess, waitForProcess)
+import System.Process (ProcessHandle, runProcess, waitForProcess, system)
packageRoot, dataDir, haddockPath, baseDir, testDir, outDir :: FilePath
@@ -88,7 +87,7 @@ test = do
putStrLn "Running tests..."
handle <- runProcess haddockPath
- (["-w", "-o", outDir, "-h", "--pretty-html", "--optghc=-fglasgow-exts"
+ (["-w", "-o", outDir, "-h", "--pretty-html"
, "--optghc=-w", base, process, ghcprim] ++ opts ++ mods')
Nothing env Nothing
Nothing Nothing
@@ -143,12 +142,26 @@ stripLinks :: String -> String
stripLinks str =
let prefix = "<a href=\"" in
case stripPrefix prefix str of
- Just str' -> prefix ++ stripLinks (dropWhile (/= '"') str')
+ Just str' -> case dropWhile (/= '>') (dropWhile (/= '"') str') of
+ [] -> []
+ x:xs -> stripLinks (stripHrefEnd xs)
Nothing ->
case str of
[] -> []
x : xs -> x : stripLinks xs
+stripHrefEnd :: String -> String
+stripHrefEnd s =
+ let pref = "</a" in
+ case stripPrefix pref s of
+ Just str' -> case dropWhile (/= '>') str' of
+ [] -> []
+ x:xs -> xs
+ Nothing ->
+ case s of
+ [] -> []
+ x : xs -> x : stripHrefEnd xs
+
programOnPath :: FilePath -> IO Bool
programOnPath p = do
result <- findProgramLocation silent p