Safe Haskell | None |
---|---|
Language | Haskell2010 |
Functions to import contracts to be used in tests.
Synopsis
- readContract :: forall cp st. Each [Typeable, SingI] [cp, st] => FilePath -> Text -> Either ImportContractError (Contract, Contract cp st)
- importContract :: forall cp st. Each [Typeable, SingI] [cp, st] => FilePath -> IO (Contract, Contract cp st)
- importUntypedContract :: FilePath -> IO Contract
- data ImportContractError
- testTreesWithContract :: (Each [Typeable, SingI] [cp, st], HasCallStack) => FilePath -> ((Contract, Contract cp st) -> IO [TestTree]) -> IO [TestTree]
- testTreesWithContractL :: (Each [Typeable, SingI] [ToT cp, ToT st], HasCallStack) => FilePath -> ((Contract, Contract cp st) -> IO [TestTree]) -> IO [TestTree]
- testTreesWithTypedContract :: (Each [Typeable, SingI] [cp, st], HasCallStack) => FilePath -> (Contract cp st -> IO [TestTree]) -> IO [TestTree]
- testTreesWithUntypedContract :: HasCallStack => FilePath -> (Contract -> IO [TestTree]) -> IO [TestTree]
- concatTestTrees :: [IO [TestTree]] -> IO [TestTree]
- specWithContract :: (Each [Typeable, SingI] [cp, st], HasCallStack) => FilePath -> ((Contract, Contract cp st) -> Spec) -> Spec
- specWithContractL :: (Each [Typeable, SingI] [ToT cp, ToT st], HasCallStack) => FilePath -> ((Contract, Contract cp st) -> Spec) -> Spec
- specWithTypedContract :: (Each [Typeable, SingI] [cp, st], HasCallStack) => FilePath -> (Contract cp st -> Spec) -> Spec
- specWithUntypedContract :: FilePath -> (Contract -> Spec) -> Spec
Read, parse, typecheck
readContract :: forall cp st. Each [Typeable, SingI] [cp, st] => FilePath -> Text -> Either ImportContractError (Contract, Contract cp st) Source #
importContract :: forall cp st. Each [Typeable, SingI] [cp, st] => FilePath -> IO (Contract, Contract cp st) Source #
Import contract from a given file path.
This function reads file, parses and type checks a contract. Within the typechecking we assume that no contracts are originated, otherwise a type checking error will be caused.
This function may throw IOException
and ImportContractError
.
data ImportContractError Source #
Error type for importContract
function.
ICEUnexpectedParamType Type Type | |
ICEUnexpectedStorageType Type Type | |
ICEParse ParserException | |
ICETypeCheck TCError |
Instances
Eq ImportContractError Source # | |
Defined in Michelson.Test.Import (==) :: ImportContractError -> ImportContractError -> Bool # (/=) :: ImportContractError -> ImportContractError -> Bool # | |
Show ImportContractError Source # | |
Defined in Michelson.Test.Import showsPrec :: Int -> ImportContractError -> ShowS # show :: ImportContractError -> String # showList :: [ImportContractError] -> ShowS # | |
Exception ImportContractError Source # | |
Defined in Michelson.Test.Import | |
Buildable ImportContractError Source # | |
Defined in Michelson.Test.Import build :: ImportContractError -> Builder # |
Tasty helpers
testTreesWithContract :: (Each [Typeable, SingI] [cp, st], HasCallStack) => FilePath -> ((Contract, Contract cp st) -> IO [TestTree]) -> IO [TestTree] Source #
Import contract and use to create test trees. Both versions of contract are passed to the callback function (untyped and typed).
If contract's import fails, a tree with single failing test will be generated (so test tree will likely be generated unexceptionally, but a failing result will notify about problem).
testTreesWithContractL :: (Each [Typeable, SingI] [ToT cp, ToT st], HasCallStack) => FilePath -> ((Contract, Contract cp st) -> IO [TestTree]) -> IO [TestTree] Source #
Like testTreesWithContract
but for Lorentz types.
testTreesWithTypedContract :: (Each [Typeable, SingI] [cp, st], HasCallStack) => FilePath -> (Contract cp st -> IO [TestTree]) -> IO [TestTree] Source #
Like testTreesWithContract
but supplies only typed contract.
testTreesWithUntypedContract :: HasCallStack => FilePath -> (Contract -> IO [TestTree]) -> IO [TestTree] Source #
Like testTreesWithContract
but supplies only untyped contract.
HSpec helpers
specWithContract :: (Each [Typeable, SingI] [cp, st], HasCallStack) => FilePath -> ((Contract, 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 fails, a spec with single failing expectation will be generated (so tests will likely run unexceptionally, but a failing result will notify about problem).
specWithContractL :: (Each [Typeable, SingI] [ToT cp, ToT st], HasCallStack) => FilePath -> ((Contract, Contract cp st) -> Spec) -> Spec Source #
Like specWithContract
, but for Lorentz types.
specWithTypedContract :: (Each [Typeable, SingI] [cp, st], HasCallStack) => FilePath -> (Contract cp st -> Spec) -> Spec Source #
A version of specWithContract
which passes only the typed
representation of the contract.