cleveland-0.2.1: Testing framework for Morley.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Cleveland.Doc.Common

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
Buildable DocTest Source # 
Instance details

Defined in Test.Cleveland.Doc.Common

Methods

build :: DocTest -> Builder #

Eq DocTest Source # 
Instance details

Defined in Test.Cleveland.Doc.Common

Methods

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

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

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.