doctest-parallel-0.4: Test interactive Haskell examples

Safe Haskell | None
Language | Haskell2010

Test.DocTest.Internal.Parse

Contents

- exported for testing

Synopsis

- data Module a = Module {
  - moduleName :: String
  - moduleSetup :: Maybe a
  - moduleContent :: [a]
  - moduleConfig :: [Located String]
  }
- data DocTest
  - = Example Expression ExpectedResult
  - | Property Expression
- type Interaction = (Expression, ExpectedResult)
- type Expression = String
- type ExpectedResult = [ExpectedLine]
- data ExpectedLine
  - = ExpectedLine [LineChunk]
  - | WildCardLine
- data LineChunk
  - = LineChunk String
  - | WildCardChunk
- getDocTests :: String -> Ghc (Module [Located DocTest])
- getDocTestsIO :: [String] -> String -> IO (Module [Located DocTest])
- parseInteractions :: Located String -> [Located Interaction]
- parseProperties :: Located String -> [Located Expression]
- mkLineChunks :: String -> [LineChunk]

# 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]
- moduleConfig :: [Located String]

#### Instances

Instances details

Functor Module Source # |
Instance details Defined in Test.DocTest.Internal.Extract Methods fmap :: (a -> b) -> Module a -> Module b Source # (<$) :: a -> Module b -> Module a Source #
NFData a => NFData (Module a) Source # |
Instance details Defined in Test.DocTest.Internal.Extract Methods rnf :: Module a -> () Source #
Generic (Module a) Source # |

Instance details

Defined in Test.DocTest.Internal.Extract

Associated Types

type Rep (Module a) |

Instance details

Defined in Test.DocTest.Internal.Extract

type Rep (Module a) = D1 ('MetaData "Module" "Test.DocTest.Internal.Extract" "doctest-parallel-0.4-Ku6xlKqGqCgHDSZeb8KTkx" 'False) (C1 ('MetaCons "Module" 'PrefixI 'True) ((S1 ('MetaSel ('Just "moduleName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "moduleSetup") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a))) :*: (S1 ('MetaSel ('Just "moduleContent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a]) :*: S1 ('MetaSel ('Just "moduleConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Located String]))))

Methods

from :: Module a -> Rep (Module a) x Source #

to :: Rep (Module a) x -> Module a Source #

Show a => Show (Module a) Source # |
Instance details Defined in Test.DocTest.Internal.Extract Methods showsPrec :: Int -> Module a -> ShowS Source # show :: Module a -> String Source # showList :: [Module a] -> ShowS Source #
Eq a => Eq (Module a) Source # |
Instance details Defined in Test.DocTest.Internal.Extract Methods (==) :: Module a -> Module a -> Bool Source # (/=) :: Module a -> Module a -> Bool Source #
type Rep (Module a) Source # |

Instance details

Defined in Test.DocTest.Internal.Extract

type Rep (Module a) = D1 ('MetaData "Module" "Test.DocTest.Internal.Extract" "doctest-parallel-0.4-Ku6xlKqGqCgHDSZeb8KTkx" 'False) (C1 ('MetaCons "Module" 'PrefixI 'True) ((S1 ('MetaSel ('Just "moduleName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "moduleSetup") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe a))) :*: (S1 ('MetaSel ('Just "moduleContent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a]) :*: S1 ('MetaSel ('Just "moduleConfig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Located String]))))

data DocTest Source #

Constructors

Example Expression ExpectedResult |
Property Expression |

#### Instances

Instances details

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

type Interaction = (Expression, ExpectedResult) 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 Test.DocTest.Internal.Parse Methods fromString :: String -> ExpectedLine Source #
Show ExpectedLine Source # |
Instance details Defined in Test.DocTest.Internal.Parse Methods showsPrec :: Int -> ExpectedLine -> ShowS Source # show :: ExpectedLine -> String Source # showList :: [ExpectedLine] -> ShowS Source #
Eq ExpectedLine Source # |
Instance details Defined in Test.DocTest.Internal.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 Test.DocTest.Internal.Parse Methods fromString :: String -> LineChunk Source #
Show LineChunk Source # |
Instance details Defined in Test.DocTest.Internal.Parse Methods showsPrec :: Int -> LineChunk -> ShowS Source # show :: LineChunk -> String Source # showList :: [LineChunk] -> ShowS Source #
Eq LineChunk Source # |
Instance details Defined in Test.DocTest.Internal.Parse Methods (==) :: LineChunk -> LineChunk -> Bool Source # (/=) :: LineChunk -> LineChunk -> Bool Source #

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

Extract `DocTest`s from given module

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

Extract `DocTest`s from given module

# exported for testing

parseInteractions :: Located String -> [Located Interaction] Source #

Extract all interactions from given Haddock comment.

parseProperties :: Located String -> [Located Expression] Source #

Extract all properties from given Haddock comment.

mkLineChunks :: String -> [LineChunk] Source #