Safe Haskell | None |
---|---|
Language | Haskell2010 |
Functions to import contracts to be used in tests.
Synopsis
- readContract :: forall cp st. (Typeable cp, Typeable st) => FilePath -> Text -> Either ImportContractError (UntypedContract, Contract cp st)
- specWithContract :: (Typeable cp, Typeable st) => FilePath -> ((UntypedContract, Contract cp st) -> Spec) -> Spec
- specWithTypedContract :: (Typeable cp, Typeable st) => FilePath -> (Contract cp st -> Spec) -> Spec
- specWithUntypedContract :: FilePath -> (UntypedContract -> Spec) -> Spec
- importContract :: forall cp st. (Typeable cp, Typeable st) => FilePath -> IO (UntypedContract, Contract cp st)
- importUntypedContract :: FilePath -> IO UntypedContract
- data ImportContractError
Documentation
readContract :: forall cp st. (Typeable cp, Typeable st) => FilePath -> Text -> Either ImportContractError (UntypedContract, Contract cp st) Source #
specWithContract :: (Typeable cp, Typeable st) => FilePath -> ((UntypedContract, Contract cp st) -> Spec) -> Spec Source #
Import contract and use it in the spec. Both versions of contract are passed to the callback function (untyped and typed).
If contract's import failed, a spec with single failing expectation will be generated (so tests will run unexceptionally, but a failing result will notify about problem).
specWithTypedContract :: (Typeable cp, Typeable st) => FilePath -> (Contract cp st -> Spec) -> Spec Source #
A version of specWithContract
which passes only the typed
representation of the contract.
specWithUntypedContract :: FilePath -> (UntypedContract -> Spec) -> Spec Source #
importContract :: forall cp st. (Typeable cp, Typeable st) => FilePath -> IO (UntypedContract, Contract cp st) Source #
Import contract from a given file path.
This function reads file, parses and type checks contract.
This function may throw IOException
and ImportContractError
.
data ImportContractError Source #
Error type for importContract
function.
ICEUnexpectedParamType !Type !TypeRep | |
ICEUnexpectedStorageType !Type !TypeRep | |
ICEParse !ParserException | |
ICETypeCheck !TCError |
Instances
Show ImportContractError Source # | |
Defined in Morley.Test.Import showsPrec :: Int -> ImportContractError -> ShowS # show :: ImportContractError -> String # showList :: [ImportContractError] -> ShowS # | |
Exception ImportContractError Source # | |
Defined in Morley.Test.Import | |
Buildable ImportContractError Source # | |
Defined in Morley.Test.Import build :: ImportContractError -> Builder # |