mockery-0.3.5: Support functions for automated testing

Safe Haskell | None
Language | Haskell2010

Test.Mockery.Directory

Synopsis

- inTempDirectory :: IO a -> IO a
- inTempDirectoryNamed :: FilePath -> IO a -> IO a
- withFile :: String -> (FilePath -> IO a) -> IO a
- touch :: FilePath -> IO ()

# Documentation

inTempDirectory :: IO a -> IO a Source #

Run given action with the current working directory set to a temporary directory.

The directory is created before the action is run. After the action has completed the directory is removed and the current working directory is restored to its original value.

inTempDirectoryNamed :: FilePath -> IO a -> IO a Source #

Similar to `inTempDirectory`, but the temporary directory will have the specified name.

withFile :: String -> (FilePath -> IO a) -> IO a Source #

Create a temporary file with the given contents and execute the given action.

The file is removed after the action has completed.

touch :: FilePath -> IO () Source #

Update the modification time of the specified file. Create an empty file (including any missing directories in the file path) if the file does not exist.