aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ben Gamari <ben@smart-cactus.org>2016-11-17 16:37:41 -0500
committerGravatar Ben Gamari <ben@smart-cactus.org>2016-11-17 16:41:02 -0500
commita3f6bc7b7a18fb841c04efe0ea137096cc036764 (patch)
tree9aa4a1a58259cba20b8b7690baf85a3572863d45
parent245b6b1c3f9161233235364a58e7c5914a354a57 (diff)
testsuite: Ensure that posix005 output is normalized
The order in which getEnvironment returns its result is platform dependent. Sort the output to ensure consistent output across platforms.
-rw-r--r--tests/libposix/posix005.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/libposix/posix005.hs b/tests/libposix/posix005.hs
index 4365eb5..2988f4c 100644
--- a/tests/libposix/posix005.hs
+++ b/tests/libposix/posix005.hs
@@ -2,20 +2,23 @@
import System.IO
import System.Posix.Env
+printEnv :: IO ()
+printEnv = getEnvironment >>= print . sort
+
main = do
hSetBuffering stdout NoBuffering
term <- getEnv "TERM"
maybe (return ()) putStrLn term
setEnvironment [("one","1"),("two","2")]
- getEnvironment >>= print
+ printEnv
setEnv "foo" "bar" True
- getEnvironment >>= print
+ printEnv
setEnv "foo" "baz" True
- getEnvironment >>= print
+ printEnv
setEnv "fu" "bar" True
- getEnvironment >>= print
+ printEnv
unsetEnv "foo"
- getEnvironment >>= print
+ printEnv
clearEnv
- getEnvironment >>= print
+ printEnv