Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/b4b2f7788b63f294ae8643c776aaf493031b7848

>---------------------------------------------------------------

commit b4b2f7788b63f294ae8643c776aaf493031b7848
Author: Ian Lynagh <[email protected]>
Date:   Sun Nov 20 14:20:44 2011 +0000

    Fix and enable posix010

>---------------------------------------------------------------

 tests/lib/libposix/all.T           |    1 +
 tests/lib/libposix/posix010.hs     |   36 ++++++++++++++----------------------
 tests/lib/libposix/posix010.stdout |    7 +++----
 3 files changed, 18 insertions(+), 26 deletions(-)

diff --git a/tests/lib/libposix/all.T b/tests/lib/libposix/all.T
index 1524893..9ac1692 100644
--- a/tests/lib/libposix/all.T
+++ b/tests/lib/libposix/all.T
@@ -4,3 +4,4 @@ test('posix004', reqlib('unix'), compile_and_run, [''])
 test('posix005', [reqlib('unix'), expect_broken(5648)], compile_and_run, [''])
 test('posix006', reqlib('unix'), compile_and_run, [''])
 test('posix009', reqlib('unix'), compile_and_run, [''])
+test('posix010', reqlib('unix'), compile_and_run, [''])
diff --git a/tests/lib/libposix/posix010.hs b/tests/lib/libposix/posix010.hs
index 83d5f27..420d210 100644
--- a/tests/lib/libposix/posix010.hs
+++ b/tests/lib/libposix/posix010.hs
@@ -1,24 +1,16 @@
-import Posix
+import System.Posix
 
-main =
-    getUserEntryForName "sof"     >>= \ sof ->
-    getUserEntryForName "partain" >>= \ partain ->
-    putStr (ue2String sof) >>
-    putChar '\n' >>    
-    putStr (ue2String partain) >>
-    putChar '\n' >>    
-    getUserEntryForID (userID sof) >>= \ muid ->
-    getUserEntryForID (userID partain) >>= \ puid ->
-    putStr (ue2String muid) >>
-    putChar '\n' >>    
-    putStr (ue2String puid) >>
-    putChar '\n'
+main = do
+    root <- getUserEntryForName "root"
+    putStrLn (ue2String root)
+    root' <- getUserEntryForID (userID root)
+    putStrLn (ue2String root')
+    if homeDirectory root == homeDirectory root' &&
+       userShell     root == userShell     root'
+        then putStrLn "OK"
+        else putStrLn "Mismatch"
 
-ue2String ue =
-    name ++ (':' : (show uid) ++ (':' : (show gid) ++ (':' : home ++ (':' : 
shell))))
-  where
-    name = userName ue
-    uid = userID ue
-    gid = userGroupID ue
-    home = homeDirectory ue
-    shell = userShell ue
+ue2String ue = concat [name, ":", show uid, ":", show gid]
+    where name = userName ue
+          uid = userID ue
+          gid = userGroupID ue
diff --git a/tests/lib/libposix/posix010.stdout 
b/tests/lib/libposix/posix010.stdout
index ec1d729..77a5024 100644
--- a/tests/lib/libposix/posix010.stdout
+++ b/tests/lib/libposix/posix010.stdout
@@ -1,4 +1,3 @@
-mattson:104:401:/users/fp/mattson:/bin/csh
-partain:184:401:/users/fp/partain:/usr/local/bin/tcsh
-mattson:104:401:/users/fp/mattson:/bin/csh
-partain:184:401:/users/fp/partain:/usr/local/bin/tcsh
+root:0:0
+root:0:0
+OK



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to