Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- withLogFile ∷ FilePath → (Handle → IO a) → IO a
- checkProcessHasNotDied ∷ Text → ProcessHandle → IO Void
- failure ∷ (HasCallStack, MonadThrow m) ⇒ String → m a
- defaultNetworkId ∷ NetworkId
- readConfigFile ∷ FilePath → IO ByteString
- createSystemTempDirectory ∷ String → IO FilePath
- withTempDir ∷ MonadIO m ⇒ String → (FilePath → m r) → m r
- failAfter ∷ (HasCallStack, MonadTimer m, MonadThrow m) ⇒ DiffTime → m a → m a
- keysFor ∷ String → IO (VerificationKey PaymentKey, SigningKey PaymentKey)
Documentation
withLogFile ∷ FilePath → (Handle → IO a) → IO a Source #
Open given log file non-buffered in append mode and print a message with
filepath to stderr
on exceptions.
checkProcessHasNotDied ∷ Text → ProcessHandle → IO Void Source #
Wait for process termination and do failure
on non-zero exit code.
This function is useful for end-to-end testing of external processes esp. in
conjunction with race
combinator:
@
withCreateProcess p $
_stdin _stdout _stderr processHandle -> do
race_
(checkProcessHasNotDied "my-process" processHandle)
doStuff
@
failure ∷ (HasCallStack, MonadThrow m) ⇒ String → m a Source #
Fails a test with given error message.
This function improves over existing expectationFailure
by throwing a
HUnitFailure
exception containig the location of the error and providing
better callstack context.
readConfigFile ∷ FilePath → IO ByteString Source #
Lookup a config file similar reading a file from disk.
withTempDir ∷ MonadIO m ⇒ String → (FilePath → m r) → m r Source #
Create a temporary directory for the given action
to use.
The directory is removed if and only if the action completes successfuly.
failAfter ∷ (HasCallStack, MonadTimer m, MonadThrow m) ⇒ DiffTime → m a → m a Source #
Fail some monadic action if it does not complete within given timeout.
A DiffTime
can be represented as a decimal number of seconds.
keysFor ∷ String → IO (VerificationKey PaymentKey, SigningKey PaymentKey) Source #
Read keys form a file