Commit 51a4e402 authored by ttuegel's avatar ttuegel
Browse files

Don't prefix test output with ">>>".

Ticket #848. Removing the prefix brings "cabal test" in line with other cabal
commands, which do not prefix their output, either. Prior to this patch, the
summary notices which appear before and after each test suite were written to
the temporary log file along with the stdio from the test executable; this would
lead to duplicate notices when the contents of the temporary log file are read
onto the console. After this patch, the summary notices are never written to the
temporary log file, only to the console and the final log file (which is never
read by Cabal), removing the confusing duplicate notices.
parent 1ecf1801
......@@ -194,9 +194,8 @@ testController flags pkg_descr lbi suite preTest cmd postTest logNamer = do
unless (fromFlag $ testKeepTix flags)
$ mapM_ deleteIfExists tixFiles
-- Write summary notices indicating start of test suite
-- Write summary notice to console indicating start of test suite
notice verbosity $ summarizeSuiteStart $ PD.testName suite
appendFile tempLog $ summarizeSuiteStart $ PD.testName suite
-- Prepare standard input for test executable
appendFile tempInput $ preTest tempInput
......@@ -218,21 +217,24 @@ testController flags pkg_descr lbi suite preTest cmd postTest logNamer = do
let finalLogName = testLogDir </> logNamer suiteLog
suiteLog' = suiteLog { logFile = finalLogName }
-- Write summary notice to log file indicating end of test suite
appendFile tempLog $ summarizeSuiteFinish suiteLog'
-- Write summary notice to log file indicating start of test suite
appendFile (logFile suiteLog') $ summarizeSuiteStart $ PD.testName suite
-- Append contents of temporary log file to the final human-
-- readable log file
readFile tempLog >>= appendFile (logFile suiteLog')
-- Write end-of-suite summary notice to log file
appendFile (logFile suiteLog') $ summarizeSuiteFinish suiteLog'
-- Show the contents of the human-readable log file on the terminal
-- if there is a failure and/or detailed output is requested
let details = fromFlag $ testShowDetails flags
whenPrinting = when $ (details > Never)
&& (not (suitePassed suiteLog) || details == Always)
&& verbosity >= normal
whenPrinting $ readFile (logFile suiteLog') >>=
putStr . unlines . map (">>> " ++) . lines
whenPrinting $ readFile tempLog >>=
putStr . unlines . lines
-- Write summary notice to terminal indicating end of test suite
notice verbosity $ summarizeSuiteFinish suiteLog'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment