aboutsummaryrefslogtreecommitdiff
path: root/haddock-library/test/Documentation/Haddock
diff options
context:
space:
mode:
authoridontgetoutmuch <dominic@steinitz.org>2015-12-20 21:01:47 +0000
committeridontgetoutmuch <dominic@steinitz.org>2015-12-20 21:01:47 +0000
commit2bdfda1fb2e0de696ca8c6f7a152b2f85a541be9 (patch)
treecc29895f7d69f051cfec172bb0f8c2ef03552789 /haddock-library/test/Documentation/Haddock
parent5a57a24c44e06e964c4ea2276c842c722c4e93d9 (diff)
parentfa03f80d76f1511a811a0209ea7a6a8b6c58704f (diff)
Merge pull request #1 from haskell/ghc-head
Ghc head
Diffstat (limited to 'haddock-library/test/Documentation/Haddock')
-rw-r--r--haddock-library/test/Documentation/Haddock/ParserSpec.hs24
1 files changed, 22 insertions, 2 deletions
diff --git a/haddock-library/test/Documentation/Haddock/ParserSpec.hs b/haddock-library/test/Documentation/Haddock/ParserSpec.hs
index 44ec2988..2ef414fb 100644
--- a/haddock-library/test/Documentation/Haddock/ParserSpec.hs
+++ b/haddock-library/test/Documentation/Haddock/ParserSpec.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE OverloadedStrings, FlexibleInstances #-}
+{-# LANGUAGE LambdaCase #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Documentation.Haddock.ParserSpec (main, spec) where
@@ -55,8 +56,10 @@ spec = do
it "accepts hexadecimal character references" $ do
"&#x65;" `shouldParseTo` "e"
- it "allows to backslash-escape characters" $ do
- property $ \x -> ['\\', x] `shouldParseTo` DocString [x]
+ it "allows to backslash-escape characters except \\r" $ do
+ property $ \case
+ '\r' -> "\\\r" `shouldParseTo` DocString "\\"
+ x -> ['\\', x] `shouldParseTo` DocString [x]
context "when parsing strings contaning numeric character references" $ do
it "will implicitly convert digits to characters" $ do
@@ -693,6 +696,23 @@ spec = do
]
<> DocOrderedList [ DocParagraph "baz" ]
+ it "allows arbitrary initial indent of a list" $ do
+ unlines
+ [ " * foo"
+ , " * bar"
+ , ""
+ , " * quux"
+ , ""
+ , " * baz"
+ ]
+ `shouldParseTo`
+ DocUnorderedList
+ [ DocParagraph "foo"
+ , DocParagraph "bar"
+ <> DocUnorderedList [ DocParagraph "quux" ]
+ , DocParagraph "baz"
+ ]
+
it "definition lists can come back to top level with a different list" $ do
"[foo]: foov\n\n [bar]: barv\n\n1. baz" `shouldParseTo`
DocDefList [ ("foo", "foov"