diff options
author | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2014-05-05 05:16:19 +0200 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2014-05-05 09:19:49 +0200 |
commit | 7ac2d0f2d31c2e1c7ede09828f3d5ba5626bd0d4 (patch) | |
tree | 646d89bbeeb15e7e163788d335ccb74b5e3654a2 /test | |
parent | dba02d6df32534aac5d257f2d28596238d248942 (diff) |
Prepare modules for parser split.
We have to generalise the Doc (now DocH) slightly to remove the
dependency on GHC-supplied type.
Diffstat (limited to 'test')
-rw-r--r-- | test/Haddock/Parser/UtilSpec.hs | 2 | ||||
-rw-r--r-- | test/Haddock/ParserSpec.hs | 23 |
2 files changed, 12 insertions, 13 deletions
diff --git a/test/Haddock/Parser/UtilSpec.hs b/test/Haddock/Parser/UtilSpec.hs index acb88220..9e1e8de1 100644 --- a/test/Haddock/Parser/UtilSpec.hs +++ b/test/Haddock/Parser/UtilSpec.hs @@ -5,7 +5,7 @@ import Test.Hspec import Data.Either import Data.Attoparsec.ByteString.Char8 -import Haddock.Parser.Util +import Haddock.Parser main :: IO () main = hspec spec diff --git a/test/Haddock/ParserSpec.hs b/test/Haddock/ParserSpec.hs index f44b7d0f..53fef943 100644 --- a/test/Haddock/ParserSpec.hs +++ b/test/Haddock/ParserSpec.hs @@ -26,20 +26,19 @@ 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 - fromString = mkVarUnqual . fsLit - -instance IsString (Doc RdrName) where +instance IsString (Doc String) where fromString = DocString instance IsString a => IsString (Maybe a) where fromString = Just . fromString -parseParas :: String -> Doc RdrName -parseParas = Parse.parseParas dynFlags +parseParas :: String -> Doc String +parseParas = Parse.toRegular . Parse.parseParas + +parseString :: String -> Doc String +parseString = Parse.toRegular . Parse.parseString + -parseString :: String -> Doc RdrName -parseString = Parse.parseString dynFlags main :: IO () main = hspec spec @@ -48,7 +47,7 @@ spec :: Spec spec = before initStaticOpts $ do describe "parseString" $ do let infix 1 `shouldParseTo` - shouldParseTo :: String -> Doc RdrName -> Expectation + shouldParseTo :: String -> Doc String -> Expectation shouldParseTo input ast = parseString input `shouldBe` ast it "is total" $ do @@ -96,7 +95,7 @@ spec = before initStaticOpts $ do "don't use apostrophe's in the wrong place's" context "when parsing URLs" $ do - let hyperlink :: String -> Maybe String -> Doc RdrName + let hyperlink :: String -> Maybe String -> Doc String hyperlink url = DocHyperlink . Hyperlink url it "parses a URL" $ do @@ -154,7 +153,7 @@ spec = before initStaticOpts $ do hyperlink "http://example.com/" Nothing <> "? Some other sentence." context "when parsing pictures" $ do - let picture :: String -> Maybe String -> Doc RdrName + let picture :: String -> Maybe String -> Doc String picture uri = DocPic . Picture uri it "parses a simple picture" $ do @@ -310,7 +309,7 @@ spec = before initStaticOpts $ do describe "parseParas" $ do let infix 1 `shouldParseTo` - shouldParseTo :: String -> Doc RdrName -> Expectation + shouldParseTo :: String -> Doc String -> Expectation shouldParseTo input ast = parseParas input `shouldBe` ast it "is total" $ do |