Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utilities for testing documentations sanity.
These tests serve to ensure that documentation generation is not broken and that user follows sane documentation structure (e.g. contract should be named, some entities require description, e.t.c).
Synopsis
- data DocTest = DocTest {
- dtDeclLoc :: SrcLoc
- dtDesc :: String
- dtSuite :: HasCallStack => ContractDoc -> Assertion
- mkDocTest :: HasCallStack => String -> (HasCallStack => ContractDoc -> Assertion) -> DocTest
- excludeDocTest :: HasCallStack => DocTest -> [DocTest] -> [DocTest]
- excludeDocTests :: [DocTest] -> [DocTest] -> [DocTest]
- runDocTests :: HasCallStack => [DocTest] -> ContractDoc -> [TestTree]
- expectDocTestFailure :: DocTest -> ContractDoc -> Assertion
- testDocBasic :: [DocTest]
- testContractNameAtTop :: DocTest
- testDocNotEmpty :: DocTest
- testNoAdjacentDescriptions :: DocTest
- forEachContractLayer :: ContractDoc -> (Maybe SomeDocItem -> DocBlock -> r) -> [r]
Documentation
Test case for contract documentation.
DocTest | |
|
mkDocTest :: HasCallStack => String -> (HasCallStack => ContractDoc -> Assertion) -> DocTest Source #
Construct DocTest
.
excludeDocTest :: HasCallStack => DocTest -> [DocTest] -> [DocTest] Source #
Exclude given test suite.
excludeDocTests :: [DocTest] -> [DocTest] -> [DocTest] Source #
Calling excludeDocTests tests toExclude
returns all test suites from
tests
which are not present in toExclude
.
runDocTests :: HasCallStack => [DocTest] -> ContractDoc -> [TestTree] Source #
Finalize test suites.
expectDocTestFailure :: DocTest -> ContractDoc -> Assertion Source #
Ensure that DocTest
check fires on given contract.
Used in tests on this module.
Test predicates
testDocBasic :: [DocTest] Source #
Base properties which should comply for all documentations.
Individual test predicates
testContractNameAtTop :: DocTest Source #
Check that contract documentation is wrapped with contractName
.
testDocNotEmpty :: DocTest Source #
Check that there is at least one non-grouping doc item.
If there is no such, rendered documentation will be empty which signals about most of the documentation pieces being lost.
testNoAdjacentDescriptions :: DocTest Source #
Check that no group contains two DDescription
items.
Normally such behaviour is allowed and can be exploited, but often it is not
and multiple descriptions appearence under the same group signals about
missing grouping wrapper (e.g. use of caseT
instead of entryCase
).
Utilities
forEachContractLayer :: ContractDoc -> (Maybe SomeDocItem -> DocBlock -> r) -> [r] Source #
Apply given function to each group (created with DocGroup
instruction)
within a contract recursively.
This function will accept grouping doc item itself (unless we are at root)
and its subcontents.