show doctest failures on stderr, less verbose make doctest

This commit is contained in:
Simon Michael 2009-06-05 18:59:59 +00:00
parent 1bc8f8430f
commit 5e08ad821e
2 changed files with 5 additions and 5 deletions

View File

@ -111,8 +111,8 @@ unittest:
# run doc tests # run doc tests
doctest: tools/doctest doctest: tools/doctest
@(tools/doctest Commands/Add.hs \ @(tools/doctest Commands/Add.hs >/dev/null \
&& tools/doctest Tests.hs \ && tools/doctest Tests.hs >/dev/null \
&& echo $@ passed) || echo $@ FAILED && echo $@ passed) || echo $@ FAILED
# make sure we have no haddock errors # make sure we have no haddock errors

View File

@ -31,7 +31,7 @@ module Main where
import Data.List (isPrefixOf) import Data.List (isPrefixOf)
import System (getArgs) import System (getArgs)
import System.Exit (ExitCode(ExitSuccess)) import System.Exit (ExitCode(ExitSuccess))
import System.IO (hGetContents) import System.IO (hGetContents, hPutStr, hPutStrLn, stderr)
import System.Process (runInteractiveCommand, waitForProcess) import System.Process (runInteractiveCommand, waitForProcess)
import Text.Printf (printf) import Text.Printf (printf)
@ -56,10 +56,10 @@ runShellDocTest s = do
putStrLn "ok" putStrLn "ok"
return True return True
else do else do
putStr $ printf "FAILED\nExpected:\n%sGot:\n%s" expected output hPutStr stderr $ printf "FAILED\nExpected:\n%sGot:\n%s" expected output
return False return False
else do else do
putStrLn $ printf "ERROR: %s" (show exit) hPutStrLn stderr $ printf "ERROR: %s" (show exit)
return False return False
splitDocTest s = (strip $ drop 1 $ strip $ head ls, unlines $ tail ls) splitDocTest s = (strip $ drop 1 $ strip $ head ls, unlines $ tail ls)