Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Testing predicates for documentation of Lorentz contracts.
Test predicates
testLorentzDoc :: [DocTest] Source #
Tests all properties.
Individual test predicates
testDeclaresParameter :: DocTest Source #
Check that contract documents its parameter.
testEachEntrypointIsDescribed :: DocTest Source #
It's a common issue to forget to describe an entrypoint.
testParamBuildingStepsAreFinalized :: DocTest Source #
Check that finalizeParamCallingDoc
is applied to the contract as it
always should.
testAllEntrypointsAreCallable :: DocTest Source #
Check that all documented entrypoints are callable.
Sometimes having such an entrypoint is fine, e.g. when you have an explicit
default entrypoint deep in one arm then other arms (entire arms, not
individual entrypoints within them) are uncallable unless also assigned a
field annotation; for example see [doc for uncallable entrypoints] note.
If this is your case, exclude this test suite with excludeDocTest
.
But such situations are rare.
More often, this test failure indicates that entrypoints are documented
incorrectly, e.g. caseT
is used in some place instead of entryCase
.
Check whether printed building steps are correct.
NB: another, simplified example of case when disabling this test is justified:
data SubParam1 = Do1 | Default
data SubParam2 = Do2 | Do3
data Param = Arm1 SubParam1 | Arm2 SubParam2
-- ^ with entrypoints derived via EpdRecursive
In this case entire Arm1
and Arm2
are not true entrypoints, only Default
and Do{1,2,3}
are, but Arm1
and Arm2
will still appear in documentation
as entrypoints.
testAllErrorsBelongToEntrypoints :: DocTest Source #
Check that no error is thrown outside of entrypoint.
This is possible e.g. when some check is performed in the beginning of the contract, before an entrypoint is selected and executed.
All errors (except for internal ones) must belong to some entrypoint for documetation to be constructed sanely. Thus it might be necessary to create a special section common for multiple entrypoints to include that error.
Re-exports
module Test.Cleveland.Doc.Common