[commit: base] master: Whitespace and modernise some tests (cad7167)
Ian Lynagh
igloo at earth.li
Sun Nov 20 01:12:50 CET 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/cad7167944d90eac9d2454eddfcac561642f2551
>---------------------------------------------------------------
commit cad7167944d90eac9d2454eddfcac561642f2551
Author: Ian Lynagh <igloo at earth.li>
Date: Sat Nov 19 23:46:51 2011 +0000
Whitespace and modernise some tests
>---------------------------------------------------------------
tests/System/getArgs001.hs | 11 +++++------
tests/System/getEnv001.hs | 2 +-
tests/System/system001.hs | 22 +++++++++++++---------
3 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/tests/System/getArgs001.hs b/tests/System/getArgs001.hs
index 4b8df91..8441fb7 100644
--- a/tests/System/getArgs001.hs
+++ b/tests/System/getArgs001.hs
@@ -1,9 +1,8 @@
import System.Environment (getProgName, getArgs)
-main =
- getProgName >>= \ argv0 ->
- putStr argv0 >>
- getArgs >>= \ argv ->
- sequence (map (\ x -> putChar ' ' >> putStr x) argv) >>
- putChar '\n'
+main = do argv0 <- getProgName
+ putStr argv0
+ argv <- getArgs
+ mapM_ (\ x -> putChar ' ' >> putStr x) argv
+ putChar '\n'
diff --git a/tests/System/getEnv001.hs b/tests/System/getEnv001.hs
index 745f8ea..b30db0f 100644
--- a/tests/System/getEnv001.hs
+++ b/tests/System/getEnv001.hs
@@ -12,4 +12,4 @@ main = do
getEnv_except :: IOError -> IO String
getEnv_except ioe
| isDoesNotExistError ioe = return ""
- | otherwise = ioError ioe
+ | otherwise = ioError ioe
diff --git a/tests/System/system001.hs b/tests/System/system001.hs
index 4237d52..7d5c0bd 100644
--- a/tests/System/system001.hs
+++ b/tests/System/system001.hs
@@ -3,12 +3,16 @@
import System.Cmd (system)
import System.Exit (ExitCode(..), exitWith)
-main =
- system "cat dog 1>/dev/null 2>&1" >>= \ ec ->
- case ec of
- ExitSuccess -> putStr "What?!?\n" >> ioError (userError "dog succeeded")
- ExitFailure _ ->
- system "cat system001.hs 2>/dev/null" >>= \ ec ->
- case ec of
- ExitSuccess -> exitWith ExitSuccess
- ExitFailure _ -> putStr "What?!?\n" >> ioError (userError "cat failed")
+main = do ec <- system "cat dog 1>/dev/null 2>&1"
+ case ec of
+ ExitSuccess ->
+ do putStr "What?!?\n"
+ ioError (userError "dog succeeded")
+ ExitFailure _ ->
+ do ec <- system "cat system001.hs 2>/dev/null"
+ case ec of
+ ExitSuccess ->
+ exitWith ExitSuccess
+ ExitFailure _ ->
+ do putStr "What?!?\n"
+ ioError (userError "cat failed")
More information about the Cvs-libraries
mailing list