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 {}
- mkDocTest :: HasCallStack => String -> (HasCallStack => ContractDoc -> Assertion) -> DocTest
- excludeDocTest :: HasCallStack => DocTest -> [DocTest] -> [DocTest]
- excludeDocTests :: [DocTest] -> [DocTest] -> [DocTest]
- runDocTests :: (ContainsDoc code, HasCallStack) => [DocTest] -> code -> [TestTree]
- expectDocTestFailure :: ContainsDoc code => DocTest -> code -> Assertion
- allContractLayers :: ContractDoc -> [(Maybe SomeDocItem, DocBlock)]
- allContractDocItems :: DocItem d => ContractDoc -> [d]
- buildDocTest :: ContainsDoc a => a -> ContractDoc
- buildMarkdownDocTest :: ContainsDoc a => a -> LText
Documentation
Test case for contract documentation.
DocTest | |
|
mkDocTest :: HasCallStack => String -> (HasCallStack => ContractDoc -> Assertion) -> DocTest Source #
Construct DocTest
.
Note: you should not declare helpers with this function rather use it directly in every test suite.
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 :: (ContainsDoc code, HasCallStack) => [DocTest] -> code -> [TestTree] Source #
Finalize test suites.
expectDocTestFailure :: ContainsDoc code => DocTest -> code -> Assertion Source #
Ensure that DocTest
check fires on given contract.
Used in tests on this module.
Utilities
allContractLayers :: ContractDoc -> [(Maybe SomeDocItem, DocBlock)] Source #
Collect all doc groups (created with DocGroup
instruction)
within a contract recursively.
The result will contain grouping doc item itself (unless we are at root)
and its subcontents.
allContractDocItems :: DocItem d => ContractDoc -> [d] Source #
Collect all doc items (atomic and grouping) recursively.
Misc
buildDocTest :: ContainsDoc a => a -> ContractDoc Source #
Like buildDoc
, but does not require documentation to be finalized.
buildMarkdownDocTest :: ContainsDoc a => a -> LText Source #
Like buildMarkdownDoc
, but does not require documentation to be finalized.