Skip to content

Commit

Permalink
tests: Allow easier debugging
Browse files Browse the repository at this point in the history
Allow easier debugging by running the tests with a "DEBUG=1" environment
variable, which prints all captured output to STDERR.
  • Loading branch information
romanofski committed Sep 10, 2017
1 parent 03369fa commit ec6da51
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/TestUserAcceptance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import Control.Concurrent
(newEmptyMVar, putMVar, takeMVar, MVar, threadDelay)
import Control.Exception (catch, IOException)
import System.IO (hPutStr, stderr)
import Control.Monad (void)
import System.Environment (lookupEnv)
import Control.Monad (void, when)
import Data.Maybe (isJust)

import Data.List (isInfixOf)
import System.Process (callProcess, readProcess)
Expand Down Expand Up @@ -320,6 +322,8 @@ runSteps stepfx steps =
(\a ->
do stepfx (asDescription a)
out <- performStep "purebredtest" a
d <- lookupEnv "DEBUG"
when (isJust d) $ hPutStr stderr ("\n\n" ++ asDescription a ++ "\n\n" ++ out)
((asAssertInOutput a) out (asExpected a)))
steps

Expand Down

0 comments on commit ec6da51

Please sign in to comment.