diff options
author | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2013-09-03 01:29:27 +0100 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-01-12 14:48:35 -0600 |
commit | b11f371fdc9197cb45a6dafbcc0b095273d6614f (patch) | |
tree | 47dcee8f16e17903dfa059ed9236f276d6cdf1b0 /test/Haddock/ParserSpec.hs | |
parent | ef9aa98d6ccbe79888c501f94c9aa6688520c28e (diff) |
Allow for headings inside function documentation.
LaTeX will treat the h3-h6 headings the same as we'd have to hack the
style file heavily otherwise and it would make the headings tiny
anyway.
Hoogle upstream said they will put in the functionality on their end.
Conflicts:
src/Haddock/Interface/Rename.hs
src/Haddock/Types.hs
test/Haddock/ParserSpec.hs
Diffstat (limited to 'test/Haddock/ParserSpec.hs')
-rw-r--r-- | test/Haddock/ParserSpec.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Haddock/ParserSpec.hs b/test/Haddock/ParserSpec.hs index 8c8e25ca..b5a9561f 100644 --- a/test/Haddock/ParserSpec.hs +++ b/test/Haddock/ParserSpec.hs @@ -21,7 +21,9 @@ import Helper instance Outputable a => Show a where show = showSDoc dynFlags . ppr +deriving instance Show a => Show (Header a) deriving instance Show a => Show (Doc a) +deriving instance Eq a => Eq (Header a) deriving instance Eq a => Eq (Doc a) instance IsString RdrName where @@ -651,3 +653,20 @@ spec = before initStaticOpts $ do ("cat", "kitten\n") , ("pineapple", "fruit\n") ] + + context "when parsing function documentation headers" $ do + it "can parse a simple header" $ do + "= Header 1\nHello." `shouldParseTo` + DocParagraph (DocHeader (Header 1 "Header 1")) + <> DocParagraph "Hello." + + it "allow consecutive headers" $ do + "= Header 1\n== Header 2" `shouldParseTo` + DocParagraph (DocHeader (Header 1 "Header 1")) + <> DocParagraph (DocHeader (Header 2 "Header 2")) + + it "accepts markup in the header" $ do + "= /Header/ __1__\nFoo" `shouldParseTo` + DocParagraph (DocHeader + (Header 1 (DocEmphasis "Header" <> " " <> DocBold "1"))) + <> DocParagraph "Foo" |