From 29cc846dc07a0c086df9a64acc4d7381b1d1eef6 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 22 Jun 2009 15:47:05 +0000 Subject: [PATCH] avoid exitSuccess for base 3 compatibility (issue #2) --- Tests.hs | 4 ++-- tools/doctest.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests.hs b/Tests.hs index 1f264956a..2632a46ba 100644 --- a/Tests.hs +++ b/Tests.hs @@ -202,7 +202,7 @@ import Data.Time.Format import Locale (defaultTimeLocale) import Text.ParserCombinators.Parsec import Test.HUnit.Tools (runVerboseTests) -import System.Exit (exitFailure,exitSuccess) +import System.Exit (exitFailure, exitWith, ExitCode(ExitSuccess)) -- base 3 compatible import Commands.All import Ledger @@ -214,7 +214,7 @@ runtests opts args = do (counts,_) <- runner ts if errors counts > 0 || (failures counts > 0) then exitFailure - else exitSuccess + else exitWith ExitSuccess where runner | (Verbose `elem` opts) = runVerboseTests | otherwise = \t -> runTestTT t >>= return . (flip (,) 0) diff --git a/tools/doctest.hs b/tools/doctest.hs index 8aa463588..741231c91 100644 --- a/tools/doctest.hs +++ b/tools/doctest.hs @@ -30,7 +30,7 @@ to that, and/or add this to hledger's built-in test runner. module Main where import Data.List (isPrefixOf) 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.Process (runInteractiveCommand, waitForProcess) import Text.Printf (printf) @@ -41,7 +41,7 @@ main = do let tests = doctests s putStrLn $ printf "Running %d doctests from %s" (length tests) f 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 s = do