Skip to content
Snippets Groups Projects
Commit a3f6bc7b authored by Ben Gamari's avatar Ben Gamari :turtle:
Browse files

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.
parent 245b6b1c
No related branches found
No related tags found
No related merge requests found
...@@ -2,20 +2,23 @@ ...@@ -2,20 +2,23 @@
import System.IO import System.IO
import System.Posix.Env import System.Posix.Env
printEnv :: IO ()
printEnv = getEnvironment >>= print . sort
main = do main = do
hSetBuffering stdout NoBuffering hSetBuffering stdout NoBuffering
term <- getEnv "TERM" term <- getEnv "TERM"
maybe (return ()) putStrLn term maybe (return ()) putStrLn term
setEnvironment [("one","1"),("two","2")] setEnvironment [("one","1"),("two","2")]
getEnvironment >>= print printEnv
setEnv "foo" "bar" True setEnv "foo" "bar" True
getEnvironment >>= print printEnv
setEnv "foo" "baz" True setEnv "foo" "baz" True
getEnvironment >>= print printEnv
setEnv "fu" "bar" True setEnv "fu" "bar" True
getEnvironment >>= print printEnv
unsetEnv "foo" unsetEnv "foo"
getEnvironment >>= print printEnv
clearEnv clearEnv
getEnvironment >>= print printEnv
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment