morley-1.2.0: Developer tools for the Michelson Language
Safe HaskellNone
LanguageHaskell2010

Michelson.Doc.Test

Description

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

Documentation

data DocTest Source #

Test case for contract documentation.

Constructors

DocTest 

Fields

Instances

Instances details
Eq DocTest Source # 
Instance details

Defined in Michelson.Doc.Test

Methods

(==) :: DocTest -> DocTest -> Bool #

(/=) :: DocTest -> DocTest -> Bool #

Show DocTest Source # 
Instance details

Defined in Michelson.Doc.Test

Buildable DocTest Source # 
Instance details

Defined in Michelson.Doc.Test

Methods

build :: DocTest -> Builder #

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 :: 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.

testNoGitInfo :: DocTest Source #

Check that contracts themselves do not set the git revision. It is supposed to be filled only in the executable.

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.

forEachContractDocItem :: DocItem d => ContractDoc -> (d -> r) -> [r] Source #

Apply given function to each doc item within a contract.