[commit: haddock] ghc-7.6: unit-tests: Minor refactoring (a9de80e)

Simon Hengel <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/haddock

On branch  : ghc-7.6

http://hackage.haskell.org/trac/ghc/changeset/a9de80ea72421837848cbdca01745e2a5b9920a7

>---------------------------------------------------------------

commit a9de80ea72421837848cbdca01745e2a5b9920a7
Author: Simon Hengel <[email protected]>
Date:   Sun Oct 14 23:37:21 2012 +0200

    unit-tests: Minor refactoring
    
    Rename parse to parseParas.

>---------------------------------------------------------------

 tests/unit-tests/Haddock/ParseSpec.hs |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/unit-tests/Haddock/ParseSpec.hs b/tests/unit-tests/Haddock/ParseSpec.hs
index f7b32fb..adaca3f 100644
--- a/tests/unit-tests/Haddock/ParseSpec.hs
+++ b/tests/unit-tests/Haddock/ParseSpec.hs
@@ -6,7 +6,7 @@ import           Test.Hspec
 import           RdrName (RdrName)
 import           DynFlags (DynFlags, defaultDynFlags)
 import           Haddock.Lex (tokenise)
-import           Haddock.Parse (parseParas)
+import qualified Haddock.Parse as Parse
 import           Haddock.Types
 import           Outputable (Outputable, showSDoc, ppr)
 import           Data.Monoid
@@ -24,8 +24,8 @@ deriving instance Eq a =>Eq (Doc a)
 instance IsString (Doc RdrName) where
   fromString = DocString
 
-parse :: String -> Maybe (Doc RdrName)
-parse s = parseParas $ tokenise dynFlags s (0,0)
+parseParas :: String -> Maybe (Doc RdrName)
+parseParas s = Parse.parseParas $ tokenise dynFlags s (0,0)
 
 main :: IO ()
 main = hspec spec
@@ -34,44 +34,44 @@ spec :: Spec
 spec = do
   describe "parseParas" $ do
     it "parses a paragraph" $ do
-      parse "foobar" `shouldBe` Just (DocParagraph "foobar\n")
+      parseParas "foobar" `shouldBe` Just (DocParagraph "foobar\n")
 
     context "when parsing an example" $ do
       it "requires an example to be separated from a previous paragrap by an empty line" $ do
-        parse "foobar\n\n>>> fib 10\n55" `shouldBe`
+        parseParas "foobar\n\n>>> fib 10\n55" `shouldBe`
           Just (DocParagraph "foobar\n" <> DocExamples [Example "fib 10" ["55"]])
 
         -- parse error
-        parse "foobar\n>>> fib 10\n55" `shouldBe` Nothing
+        parseParas "foobar\n>>> fib 10\n55" `shouldBe` Nothing
 
       it "parses a result line that only contains <BLANKLINE> as an emptly line" $ do
-        parse ">>> putFooBar\nfoo\n<BLANKLINE>\nbar" `shouldBe`
+        parseParas ">>> putFooBar\nfoo\n<BLANKLINE>\nbar" `shouldBe`
           Just (DocExamples [Example "putFooBar" ["foo","","bar"]])
 
     context "when parsing a code block" $ do
       it "requires a code blocks to be separated from a previous paragrap by an empty line" $ do
-        parse "foobar\n\n> some code" `shouldBe`
+        parseParas "foobar\n\n> some code" `shouldBe`
           Just (DocParagraph "foobar\n" <> DocCodeBlock " some code\n")
 
         -- parse error
-        parse "foobar\n> some code" `shouldBe` Nothing
+        parseParas "foobar\n> some code" `shouldBe` Nothing
 
 
     context "when parsing a URL" $ do
       it "parses a URL" $ do
-        parse "<http://example.com/>" `shouldBe`
+        parseParas "<http://example.com/>" `shouldBe`
           Just (DocParagraph $ hyperlink "http://example.com/" Nothing <> "\n")
 
       it "accepts an optional label" $ do
-        parse "<http://example.com/ some link>" `shouldBe`
+        parseParas "<http://example.com/ some link>" `shouldBe`
           Just (DocParagraph $ hyperlink "http://example.com/" (Just "some link") <> "\n")
 
     context "when parsing properties" $ do
       it "can parse a single property" $ do
-        parse "prop> 23 == 23" `shouldBe` Just (DocProperty "23 == 23")
+        parseParas "prop> 23 == 23" `shouldBe` Just (DocProperty "23 == 23")
 
       it "can parse a multiple subsequent properties" $ do
-        parse $ unlines [
+        parseParas $ unlines [
               "prop> 23 == 23"
             , "prop> 42 == 42"
             ]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.