hedgehog-extras-0.3.0.2: Supplemental library for hedgehog
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hedgehog.Extras.Test.File

Synopsis

Documentation

createDirectoryIfMissing :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m () Source #

Create the filePath directory if it is missing.

copyFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> FilePath -> m () Source #

Copy the contents of the src file to the dst file.

renameFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> FilePath -> m () Source #

Rename the src file to dst.

createFileLink :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> FilePath -> m () Source #

Create a symbolic link from dst to src.

listDirectory :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m [FilePath] Source #

List p directory.

appendFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> String -> m () Source #

Append contents to the filePath file.

writeFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> String -> m () Source #

Write contents to the filePath file.

openFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> IOMode -> m Handle Source #

Open a handle to the filePath file.

readFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m String Source #

Read the contents of the filePath file.

lbsWriteFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> ByteString -> m () Source #

Write contents to the filePath file.

lbsReadFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m ByteString Source #

Read the contents of the filePath file.

textWriteFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> Text -> m () Source #

Write contents to the filePath file.

textReadFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m Text Source #

Read the contents of the filePath file.

copyRewriteJsonFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> FilePath -> (Value -> Value) -> m () Source #

Rewrite the filePath JSON file using the function f.

readJsonFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m (Either String Value) Source #

Read the filePath file as JSON.

rewriteJsonFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> (Value -> Value) -> m () Source #

Rewrite the filePath JSON file using the function f.

copyRewriteYamlFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> FilePath -> (Value -> Value) -> m () Source #

Rewrite the filePath YAML file using the function f.

readYamlFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m (Either ParseException Value) Source #

Read the filePath file as YAML.

rewriteYamlFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> (Value -> Value) -> m () Source #

Rewrite the filePath YAML file using the function f.

cat :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m () Source #

Annotate the contents of the filePath file.

assertIsJsonFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m () Source #

Assert the filePath can be parsed as JSON.

assertIsYamlFile :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m () Source #

Assert the filePath can be parsed as YAML.

assertFilesExist :: (MonadTest m, MonadIO m, HasCallStack) => [FilePath] -> m () Source #

Checks if all files gives exists. If this fails, all files are deleted.

assertFileOccurences :: (MonadTest m, MonadIO m, HasCallStack) => Int -> String -> FilePath -> m () Source #

Assert the file contains the given number of occurrences of the given string

assertFileLines :: (MonadTest m, MonadIO m, HasCallStack) => (Int -> Bool) -> FilePath -> m () Source #

Assert the file contains the given number of occurrences of the given string

assertEndsWithSingleNewline :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> m () Source #

Assert the file contains the given number of occurrences of the given string

appendFileTimeDelta :: (MonadTest m, MonadIO m, HasCallStack) => FilePath -> UTCTime -> m () Source #

Write contents to the filePath file.