aboutsummaryrefslogtreecommitdiff
path: root/tests/unit-tests/parsetests.hs
diff options
context:
space:
mode:
authorKazu Yamamoto <kazu@iij.ad.jp>2013-02-01 11:59:24 +0900
committerKazu Yamamoto <kazu@iij.ad.jp>2013-02-01 11:59:24 +0900
commit8d4c94ca5a969a5ebbb791939fb0195dc672429e (patch)
tree560a944a7105cd715f9acba46790bd7e1a77f82f /tests/unit-tests/parsetests.hs
parent266a20afd2d27f28bbb62839ebc3f70bd83bfcce (diff)
parent3d25ea2929a9a9bd0768339b8ac5fd1b7c4670ad (diff)
Merge branch 'ghc-7.6' into ghc-7.6-merge-2
Conflicts: haddock.cabal src/Haddock/Interface/AttachInstances.hs src/Haddock/Interface/Create.hs src/Haddock/Interface/LexParseRn.hs src/Haddock/InterfaceFile.hs src/Haddock/Types.hs Only GHC HEAD can compile this. GHC 7.6.x cannot compile this. Some test fail.
Diffstat (limited to 'tests/unit-tests/parsetests.hs')
-rw-r--r--tests/unit-tests/parsetests.hs69
1 files changed, 0 insertions, 69 deletions
diff --git a/tests/unit-tests/parsetests.hs b/tests/unit-tests/parsetests.hs
deleted file mode 100644
index 7180a79e..00000000
--- a/tests/unit-tests/parsetests.hs
+++ /dev/null
@@ -1,69 +0,0 @@
-{-# LANGUAGE StandaloneDeriving, FlexibleInstances, UndecidableInstances, IncoherentInstances #-}
-{-# OPTIONS_GHC -fno-warn-orphans #-}
-module Main (main) where
-
-import Test.HUnit
-import RdrName (RdrName)
-import DynFlags (defaultDynFlags)
-import Haddock.Lex (tokenise)
-import Haddock.Parse (parseParas)
-import Haddock.Types
-import Outputable
-
-instance Outputable a => Show a where
- show = showSDoc . ppr
-
-deriving instance Show a => Show (Doc a)
-deriving instance Eq a =>Eq (Doc a)
-
-data ParseTest = ParseTest {
- input :: String
- , result :: (Maybe (Doc RdrName))
- }
-
-tests :: [ParseTest]
-tests = [
- ParseTest {
- input = "foobar"
- , result = Just $ DocParagraph $ DocString "foobar\n"
- }
-
- , ParseTest {
- input = "foobar\n\n>>> fib 10\n55"
- , result = Just $ DocAppend (DocParagraph $ DocString "foobar\n") (DocExamples $ [Example "fib 10" ["55"]])
- }
-
- , ParseTest {
- input = "foobar\n>>> fib 10\n55"
- , result = Nothing -- parse error
- }
-
- , ParseTest {
- input = "foobar\n\n> some code"
- , result = Just (DocAppend (DocParagraph (DocString "foobar\n")) (DocCodeBlock (DocString " some code\n")))
- }
-
- , ParseTest {
- input = "foobar\n> some code"
- , result = Nothing -- parse error
- }
-
- -- test <BLANKLINE> support
- , ParseTest {
- input = ">>> putFooBar\nfoo\n<BLANKLINE>\nbar"
- , result = Just $ DocExamples $ [Example "putFooBar" ["foo","","bar"]]
- }
- ]
-
-
-main :: IO ()
-main = do
- _ <- runTestTT $ TestList $ map toTestCase tests
- return ();
- where
-
- toTestCase :: ParseTest -> Test
- toTestCase (ParseTest s r) = TestCase $ assertEqual s r (parse s)
-
- parse :: String -> Maybe (Doc RdrName)
- parse s = parseParas $ tokenise (defaultDynFlags undefined) s (0,0)