aboutsummaryrefslogtreecommitdiff
path: root/haddock-library/test/Documentation/Haddock/ParserSpec.hs
diff options
context:
space:
mode:
authorAlexander Biehl <alexbiehl@gmail.com>2018-06-14 15:28:52 +0200
committerGitHub <noreply@github.com>2018-06-14 15:28:52 +0200
commit6247ec8b5a5bc8145ce851dce11eb617a380381c (patch)
tree7856c0dd1ddd0c1f3eef0422b0cd8e8a5a6b71cb /haddock-library/test/Documentation/Haddock/ParserSpec.hs
parent9a7f539d0c20654ff394f2ff99836412a6844df1 (diff)
parent095fa970b32c818ed4c06cefc00ba98aaff756fa (diff)
Merge pull request #857 from sjakobi/ghc-head-update-3
Update ghc-head
Diffstat (limited to 'haddock-library/test/Documentation/Haddock/ParserSpec.hs')
-rw-r--r--haddock-library/test/Documentation/Haddock/ParserSpec.hs19
1 files changed, 14 insertions, 5 deletions
diff --git a/haddock-library/test/Documentation/Haddock/ParserSpec.hs b/haddock-library/test/Documentation/Haddock/ParserSpec.hs
index b63ece92..86ed3b35 100644
--- a/haddock-library/test/Documentation/Haddock/ParserSpec.hs
+++ b/haddock-library/test/Documentation/Haddock/ParserSpec.hs
@@ -10,6 +10,8 @@ import Documentation.Haddock.Doc (docAppend)
import Test.Hspec
import Test.QuickCheck
+import Prelude hiding ((<>))
+
infixr 6 <>
(<>) :: Doc id -> Doc id -> Doc id
(<>) = docAppend
@@ -22,8 +24,15 @@ instance IsString (Doc String) where
instance IsString a => IsString (Maybe a) where
fromString = Just . fromString
+emptyMeta :: Meta
+emptyMeta =
+ Meta {
+ _version = Nothing
+ , _package = Nothing
+ }
+
parseParas :: String -> MetaDoc () String
-parseParas = overDoc Parse.toRegular . Parse.parseParas
+parseParas = overDoc Parse.toRegular . Parse.parseParas Nothing
parseString :: String -> Doc String
parseString = Parse.toRegular . Parse.parseString
@@ -373,17 +382,17 @@ spec = do
context "when parsing @since" $ do
it "adds specified version to the result" $ do
parseParas "@since 0.5.0" `shouldBe`
- MetaDoc { _meta = Meta { _version = Just [0,5,0] }
+ MetaDoc { _meta = emptyMeta { _version = Just [0,5,0] }
, _doc = DocEmpty }
it "ignores trailing whitespace" $ do
parseParas "@since 0.5.0 \t " `shouldBe`
- MetaDoc { _meta = Meta { _version = Just [0,5,0] }
+ MetaDoc { _meta = emptyMeta { _version = Just [0,5,0] }
, _doc = DocEmpty }
it "does not allow trailing input" $ do
parseParas "@since 0.5.0 foo" `shouldBe`
- MetaDoc { _meta = Meta { _version = Nothing }
+ MetaDoc { _meta = emptyMeta { _version = Nothing }
, _doc = DocParagraph "@since 0.5.0 foo" }
@@ -393,7 +402,7 @@ spec = do
"@since 0.5.0"
, "@since 0.6.0"
, "@since 0.7.0"
- ] `shouldBe` MetaDoc { _meta = Meta { _version = Just [0,7,0] }
+ ] `shouldBe` MetaDoc { _meta = emptyMeta { _version = Just [0,7,0] }
, _doc = DocEmpty }