Skip executeFile001 in threaded2 way
[packages/unix.git] / tests / user001.hs
1 -- test that none of System.Posix.User.get* fail
2 import Control.Exception as Exception
3 import System.Posix.User
4
5 check :: Show a => a -> Bool
6 check a = show a == show a
7
8 p :: Show a => String -> IO a -> IO ()
9 p s m = (do putStr (s ++ ": ")
10 c <- fmap check m
11 putStrLn $ if c then "OK" else "I am the pope!")
12 `Exception.catch` (\e -> putStrLn ("ERROR: " ++ show (e::SomeException)))
13
14 main :: IO ()
15 main = do p "getRealUserID" $ getRealUserID
16 p "getRealGroupID" $ getRealGroupID
17 p "getEffectiveUserID" $ getEffectiveUserID
18 p "getEffectiveGroupID" $ getEffectiveGroupID
19 p "getGroups" $ getGroups
20 --p "getLoginName" $ getLoginName
21 p "getEffectiveUserName" $ getEffectiveUserName
22 p "getGroupEntryForID" $ getRealGroupID >>= getGroupEntryForID
23 p "getGroupEntryForName" $ getRealGroupID >>= getGroupEntryForID >>= getGroupEntryForName . groupName
24 p "getAllGroupEntries" $ getAllGroupEntries
25 p "getUserEntryForID" $ getRealUserID >>= getUserEntryForID
26 --p "getUserEntryForName" $ getLoginName >>= getUserEntryForName
27 p "getAllUserEntries" $ getAllUserEntries