doctest-0.22.6: Test interactive Haskell examples

Safe Haskell | Safe-Inferred
Language | Haskell2010

Test.DocTest.Internal.Parse

Synopsis

- data Module a = Module {
  - moduleName :: String
  - moduleSetup :: Maybe a
  - moduleContent :: [a]
  }
- data DocTest
  - = Example Expression ExpectedResult
  - | Property Expression
- type Expression = String
- type ExpectedResult = [ExpectedLine]
- data ExpectedLine
  - = ExpectedLine [LineChunk]
  - | WildCardLine
- data LineChunk
  - = LineChunk String
  - | WildCardChunk
- extractDocTests :: [String] -> IO [Module [Located DocTest]]
- parseModules :: [Module (Located String)] -> [Module [Located DocTest]]

# Documentation

data Module a Source #

Documentation for a module grouped together with the modules name.

Constructors

Module |

Fields

- moduleName :: String
- moduleSetup :: Maybe a
- moduleContent :: [a]

#### Instances

Instances details

Functor Module Source # |
Instance details Defined in Extract Methods fmap :: (a -> b) -> Module a -> Module b Source # (<$) :: a -> Module b -> Module a Source #
Show a => Show (Module a) Source # |
Instance details Defined in Extract Methods showsPrec :: Int -> Module a -> ShowS Source # show :: Module a -> String Source # showList :: [Module a] -> ShowS Source #
NFData a => NFData (Module a) Source # |
Instance details Defined in Extract Methods rnf :: Module a -> () Source #
Eq a => Eq (Module a) Source # |
Instance details Defined in Extract Methods (==) :: Module a -> Module a -> Bool Source # (/=) :: Module a -> Module a -> Bool Source #

data DocTest Source #

Constructors

Example Expression ExpectedResult |
Property Expression |

#### Instances

Instances details

Show DocTest Source # |
Instance details Defined in Parse Methods showsPrec :: Int -> DocTest -> ShowS Source # show :: DocTest -> String Source # showList :: [DocTest] -> ShowS Source #
Eq DocTest Source # |
Instance details Defined in Parse Methods (==) :: DocTest -> DocTest -> Bool Source # (/=) :: DocTest -> DocTest -> Bool Source #

type Expression = String Source #

type ExpectedResult = [ExpectedLine] Source #

data ExpectedLine Source #

Constructors

ExpectedLine [LineChunk] |
WildCardLine |

#### Instances

Instances details

IsString ExpectedLine Source # |
Instance details Defined in Parse Methods fromString :: String -> ExpectedLine Source #
Show ExpectedLine Source # |
Instance details Defined in Parse Methods showsPrec :: Int -> ExpectedLine -> ShowS Source # show :: ExpectedLine -> String Source # showList :: [ExpectedLine] -> ShowS Source #
Eq ExpectedLine Source # |
Instance details Defined in Parse Methods (==) :: ExpectedLine -> ExpectedLine -> Bool Source # (/=) :: ExpectedLine -> ExpectedLine -> Bool Source #

data LineChunk Source #

Constructors

LineChunk String |
WildCardChunk |

#### Instances

Instances details

IsString LineChunk Source # |
Instance details Defined in Parse Methods fromString :: String -> LineChunk Source #
Show LineChunk Source # |
Instance details Defined in Parse Methods showsPrec :: Int -> LineChunk -> ShowS Source # show :: LineChunk -> String Source # showList :: [LineChunk] -> ShowS Source #
Eq LineChunk Source # |
Instance details Defined in Parse Methods (==) :: LineChunk -> LineChunk -> Bool Source # (/=) :: LineChunk -> LineChunk -> Bool Source #

extractDocTests Source #

Arguments

:: [String] |
-> IO [Module [Located DocTest]] | Extracted `DocTest`s

Extract `DocTest`s from all given modules and all modules included by the given modules.

    extractDocTests = fmap parseModules . extract

parseModules :: [Module (Located String)] -> [Module [Located DocTest]] Source #