Safe Haskell | None |
---|---|
Language | Haskell2010 |
Internal utilities for unit testing.
Synopsis
- type EPList = [(EpName, Ty)]
- data EPMismatch where
- EPMismatch {
- epmmExtra :: EPList
- epmmMissing :: EPList
- epmmTypeMismatch :: [(EpName, MismatchError Ty)]
- pattern EPComparisonResultOK :: EPMismatch
- EPMismatch {
- ignoreExtraEntrypoints :: EPMismatch -> EPMismatch
- compareEntrypoints :: ("expected" :! Map EpName Ty) -> ("actual" :! Map EpName Ty) -> EPMismatch
- contractMatchesEntrypoints :: Contract -> Map EpName Ty -> Either TCError EPMismatch
- contractCoversEntrypoints :: Contract -> Map EpName Ty -> Either TCError EPMismatch
- testContractEntrypoints :: (EPMismatch -> EPMismatch) -> TestName -> Contract -> Map EpName Ty -> TestTree
- assertEPComparisonSuccessful :: Either TCError EPMismatch -> Assertion
- michelsonRoundtripContract :: HasCallStack => Contract -> Contract
- michelineRoundtripContract :: HasCallStack => Contract -> Contract
Documentation
type EPList = [(EpName, Ty)] Source #
Convenience type synonym for a list of pairs of entrypoint names and types
data EPMismatch Source #
Entrypoint comparison mismatch report
EPMismatch | |
|
pattern EPComparisonResultOK :: EPMismatch | A pattern syononym for no mismatches |
Instances
Buildable EPMismatch Source # | |
Defined in Test.Cleveland.Michelson.Internal.Entrypoints build :: EPMismatch -> Builder # |
ignoreExtraEntrypoints :: EPMismatch -> EPMismatch Source #
Ignore extraneous entrypoint names in EPMismatch
. Essentially sets
epmmExtra
to []
.
compareEntrypoints :: ("expected" :! Map EpName Ty) -> ("actual" :! Map EpName Ty) -> EPMismatch Source #
Compare two sets of entrypoints. Accepts ordered Map
s to enforce sorting order.
contractMatchesEntrypoints :: Contract -> Map EpName Ty -> Either TCError EPMismatch Source #
Check if the contract exactly matches the given entrypoints. Will report both missing and extraneous entrypoint names, and type mismatches.
contractCoversEntrypoints :: Contract -> Map EpName Ty -> Either TCError EPMismatch Source #
Check if the contract contains the entrypoints given in spec (with matching types). Ignores any additional entrypoints present in the contract.
testContractEntrypoints :: (EPMismatch -> EPMismatch) -> TestName -> Contract -> Map EpName Ty -> TestTree Source #
Expect the contract to match with the entrypoints given in spec (with matching types).
Comparison is defined by the first argument; use ignoreExtraEntrypoints
for cover test,
id
for match test.
Also tests if the same holds after Michelson and Micheline roundtrips of the contract.
assertEPComparisonSuccessful :: Either TCError EPMismatch -> Assertion Source #
Turn Either
TCError
EPMismatch
into an Assertion
michelsonRoundtripContract :: HasCallStack => Contract -> Contract Source #
Round-trip the contract through Michelson text representation.
This is useful if you're intending to use the contract with Michelson text output and want to check if that output satisfies tests (which should be the same for internal representation and output, but bugs happen)
michelineRoundtripContract :: HasCallStack => Contract -> Contract Source #
Round-trip the contract through Micheline JSON representation.
This is useful if you're intending to use the contract with Micheline JSON output and want to check if that output satisfies tests (which should be the same for internal representation and output, but bugs happen)