avoid exitSuccess for base 3 compatibility (issue #2)
This commit is contained in:
parent
ac3498302d
commit
29cc846dc0
4
Tests.hs
4
Tests.hs
@ -202,7 +202,7 @@ import Data.Time.Format
|
|||||||
import Locale (defaultTimeLocale)
|
import Locale (defaultTimeLocale)
|
||||||
import Text.ParserCombinators.Parsec
|
import Text.ParserCombinators.Parsec
|
||||||
import Test.HUnit.Tools (runVerboseTests)
|
import Test.HUnit.Tools (runVerboseTests)
|
||||||
import System.Exit (exitFailure,exitSuccess)
|
import System.Exit (exitFailure, exitWith, ExitCode(ExitSuccess)) -- base 3 compatible
|
||||||
|
|
||||||
import Commands.All
|
import Commands.All
|
||||||
import Ledger
|
import Ledger
|
||||||
@ -214,7 +214,7 @@ runtests opts args = do
|
|||||||
(counts,_) <- runner ts
|
(counts,_) <- runner ts
|
||||||
if errors counts > 0 || (failures counts > 0)
|
if errors counts > 0 || (failures counts > 0)
|
||||||
then exitFailure
|
then exitFailure
|
||||||
else exitSuccess
|
else exitWith ExitSuccess
|
||||||
where
|
where
|
||||||
runner | (Verbose `elem` opts) = runVerboseTests
|
runner | (Verbose `elem` opts) = runVerboseTests
|
||||||
| otherwise = \t -> runTestTT t >>= return . (flip (,) 0)
|
| otherwise = \t -> runTestTT t >>= return . (flip (,) 0)
|
||||||
|
|||||||
@ -30,7 +30,7 @@ to that, and/or add this to hledger's built-in test runner.
|
|||||||
module Main where
|
module Main where
|
||||||
import Data.List (isPrefixOf)
|
import Data.List (isPrefixOf)
|
||||||
import System (getArgs)
|
import System (getArgs)
|
||||||
import System.Exit (ExitCode(ExitSuccess),exitFailure,exitSuccess)
|
import System.Exit (exitFailure, exitWith, ExitCode(ExitSuccess)) -- base 3 compatible
|
||||||
import System.IO (hGetContents, hPutStr, hPutStrLn, stderr)
|
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)
|
||||||
@ -41,7 +41,7 @@ main = do
|
|||||||
let tests = doctests s
|
let tests = doctests s
|
||||||
putStrLn $ printf "Running %d doctests from %s" (length tests) f
|
putStrLn $ printf "Running %d doctests from %s" (length tests) f
|
||||||
ok <- mapM runShellDocTest $ doctests s
|
ok <- mapM runShellDocTest $ doctests s
|
||||||
if any not ok then exitFailure else exitSuccess
|
if any not ok then exitFailure else exitWith ExitSuccess
|
||||||
|
|
||||||
runShellDocTest :: String -> IO Bool
|
runShellDocTest :: String -> IO Bool
|
||||||
runShellDocTest s = do
|
runShellDocTest s = do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user