mockery-0.3.5: Support functions for automated testing

Safe Haskell | Safe
Language | Haskell2010

Test.Mockery.Environment

Synopsis

- withEnvironment :: [(String, String)] -> IO a -> IO a
- withModifiedEnvironment :: [(String, String)] -> IO a -> IO a

# Documentation

withEnvironment :: [(String, String)] -> IO a -> IO a Source #

Run the given action within the specified environment.

Before executing the action, `withEnvironment` backs up the current environment, clears out the environment, and then applies the supplied environment. After the action has completed the original environment is restored.

Note: The environment is global to a process, so tests that modify the environment can no longer be run in parallel.

withModifiedEnvironment :: [(String, String)] -> IO a -> IO a Source #

Run the given action within an augmented environment.

Before executing the action, `withModifiedEnvironment` backs up the current environment and then augments it with the supplied values. After the action has completed the original environment is restored.

Note: The environment is global to a process, so tests that modify the environment can no longer be run in parallel.