aboutsummaryrefslogtreecommitdiff
path: root/tests/unit-tests/parsetests.hs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-07-19 20:38:26 +0100
committerIan Lynagh <igloo@earth.li>2012-07-19 20:38:26 +0100
commit7f164839d8b0b6e53fa0f15d2a6810ca310e337d (patch)
tree34a2bdeb25673b73d3a6935ab5d4170f94bc11a0 /tests/unit-tests/parsetests.hs
parent4dc9ecd3905f75adb6bcfb818fbc163c724d4545 (diff)
parent6e8bc1dca77bbbc5743f63a2e8ea5b1eab0ed80c (diff)
Merge branch 'master' of darcs.haskell.org:/srv/darcs//haddock
Diffstat (limited to 'tests/unit-tests/parsetests.hs')
-rw-r--r--tests/unit-tests/parsetests.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/unit-tests/parsetests.hs b/tests/unit-tests/parsetests.hs
index e0645401..7180a79e 100644
--- a/tests/unit-tests/parsetests.hs
+++ b/tests/unit-tests/parsetests.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE StandaloneDeriving, FlexibleInstances, UndecidableInstances, IncoherentInstances #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
module Main (main) where
import Test.HUnit
@@ -6,9 +8,13 @@ import DynFlags (defaultDynFlags)
import Haddock.Lex (tokenise)
import Haddock.Parse (parseParas)
import Haddock.Types
+import Outputable
-instance Show RdrName where
- show x = "RdrName"
+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
@@ -50,13 +56,14 @@ tests = [
]
+main :: IO ()
main = do
_ <- runTestTT $ TestList $ map toTestCase tests
return ();
where
toTestCase :: ParseTest -> Test
- toTestCase (ParseTest input result) = TestCase $ assertEqual input result (parse input)
+ toTestCase (ParseTest s r) = TestCase $ assertEqual s r (parse s)
parse :: String -> Maybe (Doc RdrName)
- parse input = parseParas $ tokenise defaultDynFlags input (0,0)
+ parse s = parseParas $ tokenise (defaultDynFlags undefined) s (0,0)